mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-02-22 22:52:56 +08:00
CHORE: Move NS test to its own function (#2318)
Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
parent
00976474cb
commit
ebe3ecdf8f
2 changed files with 31 additions and 10 deletions
3
go.mod
3
go.mod
|
@ -2,8 +2,6 @@ module github.com/StackExchange/dnscontrol/v3
|
||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require gopkg.in/yaml.v3 v3.0.1
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.1.0
|
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.1.0
|
||||||
|
@ -67,6 +65,7 @@ require (
|
||||||
github.com/vultr/govultr/v2 v2.17.2
|
github.com/vultr/govultr/v2 v2.17.2
|
||||||
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
|
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
|
||||||
golang.org/x/text v0.9.0
|
golang.org/x/text v0.9.0
|
||||||
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|
|
@ -319,14 +319,6 @@ func runTests(t *testing.T, prv providers.DNSServiceProvider, domainName string,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue https://github.com/StackExchange/dnscontrol/issues/491
|
|
||||||
t.Run("No trailing dot in nameserver", func(t *testing.T) {
|
|
||||||
for _, nameserver := range dc.Nameservers {
|
|
||||||
if strings.HasSuffix(nameserver.Name, ".") {
|
|
||||||
t.Errorf("Provider returned nameserver with trailing dot: %s (See issue https://github.com/StackExchange/dnscontrol/issues/491, TL;DR: use models.ToNameserversStripTD in GetNameservers)", nameserver)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDualProviders(t *testing.T) {
|
func TestDualProviders(t *testing.T) {
|
||||||
|
@ -381,6 +373,36 @@ func TestDualProviders(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNameserverDots(t *testing.T) {
|
||||||
|
// Issue https://github.com/StackExchange/dnscontrol/issues/491
|
||||||
|
// If this fails, the provider's GetNameservers() function uses
|
||||||
|
// models.ToNameserversStripTD() instead of models.ToNameservers()
|
||||||
|
// or vise-versa.
|
||||||
|
|
||||||
|
// Setup:
|
||||||
|
p, domain, _, _ := getProvider(t)
|
||||||
|
if p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if domain == "" {
|
||||||
|
t.Fatal("NO DOMAIN SET! Exiting!")
|
||||||
|
}
|
||||||
|
dc := getDomainConfigWithNameservers(t, p, domain)
|
||||||
|
if !providers.ProviderHasCapability(*providerToRun, providers.DocDualHost) {
|
||||||
|
t.Skip("Skipping. DocDualHost == Cannot")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Run("No trailing dot in nameserver", func(t *testing.T) {
|
||||||
|
for _, nameserver := range dc.Nameservers {
|
||||||
|
//fmt.Printf("DEBUG: nameserver.Name = %q\n", nameserver.Name)
|
||||||
|
if strings.HasSuffix(nameserver.Name, ".") {
|
||||||
|
t.Errorf("Provider returned nameserver with trailing dot: %q", nameserver)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
type TestGroup struct {
|
type TestGroup struct {
|
||||||
Desc string
|
Desc string
|
||||||
required []providers.Capability
|
required []providers.Capability
|
||||||
|
|
Loading…
Reference in a new issue