From 2a98e29eb0893b56a017a86f9b826abfce57ac4e Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Wed, 25 Oct 2017 11:52:54 -0400 Subject: [PATCH] wip! --- integrationTest/integration_test.go | 20 ++++++++++++++++++++ integrationTest/zones/example.com.zone | 2 +- providers/bind/bindProvider.go | 11 +++++++++-- providers/capabilities.go | 2 ++ providers/cloudflare/cloudflareProvider.go | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/integrationTest/integration_test.go b/integrationTest/integration_test.go index 5ef421fc1..78253def0 100644 --- a/integrationTest/integration_test.go +++ b/integrationTest/integration_test.go @@ -392,6 +392,26 @@ func makeTests(t *testing.T) []*TestCase { ) } + // Case Preserving + if !providers.ProviderHasCabability(*providerToRun, providers.CasePreserving) { + t.Log("Skipping case preserving tests because provider does not support them") + } else { + tests = append(tests, tc("Empty"), + // Create down, and change. + tc("Create Downcase", a("foo", "1.1.1.1")), + tc("Upcase", a("FOO", "1.1.1.1")), + tc("Downcase", a("foo", "1.1.1.1")), + tc("Change target", a("foo", "2.2.2.2")), + tc("Upcase and change target", a("FOO", "3.3.3.3")), + // Create up, and change. + tc("Create Upcase", a("BAR", "1.1.1.1")), + tc("Downcase", a("bar", "1.1.1.1")), + tc("Upcase", a("BAR", "1.1.1.1")), + tc("Change target", a("BAR", "2.2.2.2")), + tc("Downcase and change target", a("bar", "3.3.3.3")), + ) + } + // Test large zonefiles. // Mostly to test paging. Many providers page at 100 // Known page sizes: diff --git a/integrationTest/zones/example.com.zone b/integrationTest/zones/example.com.zone index bb7ab6ea8..0303885b0 100644 --- a/integrationTest/zones/example.com.zone +++ b/integrationTest/zones/example.com.zone @@ -1,4 +1,4 @@ $TTL 300 -@ IN SOA DEFAULT_NOT_SET. DEFAULT_NOT_SET. 2017091830 3600 600 604800 1440 +@ IN SOA DEFAULT_NOT_SET. DEFAULT_NOT_SET. 2017102758 3600 600 604800 1440 IN NS ns1.otherdomain.tld. IN NS ns2.otherdomain.tld. diff --git a/providers/bind/bindProvider.go b/providers/bind/bindProvider.go index 9dd984c9d..4933a52c9 100644 --- a/providers/bind/bindProvider.go +++ b/providers/bind/bindProvider.go @@ -56,8 +56,15 @@ func initBind(config map[string]string, providermeta json.RawMessage) (providers } func init() { - providers.RegisterDomainServiceProviderType("BIND", initBind, providers.CanUsePTR, - providers.CanUseSRV, providers.CanUseCAA, providers.CanUseTLSA, providers.CantUseNOPURGE, docNotes) + providers.RegisterDomainServiceProviderType("BIND", initBind, + providers.CanUsePTR, + providers.CanUseSRV, + providers.CanUseCAA, + providers.CanUseTLSA, + providers.CantUseNOPURGE, + providers.CasePreserving, + docNotes, + ) } type SoaInfo struct { diff --git a/providers/capabilities.go b/providers/capabilities.go index e3cf95d74..507e569cf 100644 --- a/providers/capabilities.go +++ b/providers/capabilities.go @@ -24,6 +24,8 @@ const ( // so it is easier to simply mark this feature as not working for this // provider. CantUseNOPURGE + // CasePreserving indicates the provider preserves case in DNS names. + CasePreserving // DocOfficiallySupported means it is actively used and maintained by stack exchange DocOfficiallySupported diff --git a/providers/cloudflare/cloudflareProvider.go b/providers/cloudflare/cloudflareProvider.go index ca9da707b..82d9b28a5 100644 --- a/providers/cloudflare/cloudflareProvider.go +++ b/providers/cloudflare/cloudflareProvider.go @@ -38,6 +38,7 @@ var docNotes = providers.DocumentationNotes{ providers.DocCreateDomains: providers.Can(), providers.DocOfficiallySupported: providers.Can(), providers.CanUseAlias: providers.Can("CF automatically flattens CNAME records into A records dynamically"), + providers.CasePreserving: providers.Can(), } func init() {