* 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>
72 lines
1.4 KiB
Go
72 lines
1.4 KiB
Go
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)
|
|
}
|
|
}
|
|
}
|