diff options
author | 2019-08-09 12:40:28 +0530 | |
---|---|---|
committer | 2019-08-09 08:10:28 +0100 | |
commit | 879466b0288a2d11e278950375c7593b60ea0677 (patch) | |
tree | 8f277238fd0cd9b458d63fbcc156267ad2a04006 /plugin/azure/setup_test.go | |
parent | 5b74d0f957a2565c8ee168ad55283b0914cac9d7 (diff) | |
download | coredns-879466b0288a2d11e278950375c7593b60ea0677.tar.gz coredns-879466b0288a2d11e278950375c7593b60ea0677.tar.zst coredns-879466b0288a2d11e278950375c7593b60ea0677.zip |
Add plugin for Azure DNS (#2945)
* Add plugin for Azure DNS
Signed-off-by: darshanime <deathbullet@gmail.com>
* Rename AzureDNS plugin to Azure
Signed-off-by: darshanime <deathbullet@gmail.com>
* remove upstream from azure syntax
Signed-off-by: darshanime <deathbullet@gmail.com>
* Rename azure plugin block keynames
Signed-off-by: darshanime <deathbullet@gmail.com>
* Normalize zone name before lookup in zones
Signed-off-by: darshanime <deathbullet@gmail.com>
* Update import path for caddy
Signed-off-by: darshanime <deathbullet@gmail.com>
* normalize azure zone name only if required
Signed-off-by: darshanime <deathbullet@gmail.com>
* Add support for MX, SRV, TXT, records
Signed-off-by: darshanime <deathbullet@gmail.com>
* Add specs for new record types
Signed-off-by: darshanime <deathbullet@gmail.com>
* Use sequential updates for zones
Signed-off-by: darshanime <deathbullet@gmail.com>
* Add OWNERS file for azure plugin
Signed-off-by: darshanime <deathbullet@gmail.com>
* Rename imports for third party packages
Signed-off-by: darshanime <deathbullet@gmail.com>
* Capitalize values in README
Signed-off-by: darshanime <deathbullet@gmail.com>
* Shorten keys for azure plugin config
Signed-off-by: darshanime <deathbullet@gmail.com>
* Fixup readme for azure plugin
Signed-off-by: darshanime <deathbullet@gmail.com>
Diffstat (limited to 'plugin/azure/setup_test.go')
-rw-r--r-- | plugin/azure/setup_test.go | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/plugin/azure/setup_test.go b/plugin/azure/setup_test.go new file mode 100644 index 000000000..c0b22d581 --- /dev/null +++ b/plugin/azure/setup_test.go @@ -0,0 +1,72 @@ +package azure + +import ( + "testing" + + "github.com/caddyserver/caddy" +) + +func TestSetup(t *testing.T) { + tests := []struct { + body string + expectedError bool + }{ + {`azure`, false}, + {`azure :`, true}, + {`azure resource_set:zone`, false}, + {`azure resource_set:zone { + tenant +}`, true}, + {`azure resource_set:zone { + tenant +}`, true}, + {`azure resource_set:zone { + client +}`, true}, + {`azure resource_set:zone { + secret +}`, true}, + {`azure resource_set:zone { + subscription +}`, true}, + {`azure resource_set:zone { + upstream 10.0.0.1 +}`, true}, + + {`azure resource_set:zone { + upstream +}`, true}, + {`azure resource_set:zone { + foobar +}`, true}, + {`azure resource_set:zone { + tenant tenant_id + client client_id + secret client_secret + subscription subscription_id +}`, false}, + + {`azure resource_set:zone { + fallthrough +}`, false}, + {`azure resource_set:zone { + environment AZUREPUBLICCLOUD + }`, false}, + {`azure resource_set:zone resource_set:zone { + fallthrough + }`, true}, + {`azure resource_set:zone,zone2 { + fallthrough + }`, false}, + {`azure resource-set { + fallthrough + }`, true}, + } + + for i, test := range tests { + c := caddy.NewTestController("dns", test.body) + if _, _, _, err := parse(c); (err == nil) == test.expectedError { + t.Fatalf("Unexpected errors: %v in test: %d\n\t%s", err, i, test.body) + } + } +} |