mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 02:33:21 -05:00 
			
		
		
		
	* For caddy v1 in our org This RP changes all imports for caddyserver/caddy to coredns/caddy. This is the v1 code of caddy. For the coredns/caddy repo the following changes have been made: * anything not needed by us is deleted * all `telemetry` stuff is deleted * all its import paths are also changed to point to coredns/caddy * the v1 branch has been moved to the master branch * a v1.1.0 tag has been added to signal the latest release Signed-off-by: Miek Gieben <miek@miek.nl> * Fix imports Signed-off-by: Miek Gieben <miek@miek.nl> * Group coredns/caddy with out plugins Signed-off-by: Miek Gieben <miek@miek.nl> * remove this file Signed-off-by: Miek Gieben <miek@miek.nl> * Relax import ordering github.com/coredns is now also a coredns dep, this makes github.com/coredns/caddy fit more natural in the list. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix final import Signed-off-by: Miek Gieben <miek@miek.nl>
		
			
				
	
	
		
			72 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package azure
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/coredns/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 abc
 | 
						|
}`, false},
 | 
						|
		{`azure resource_set:zone {
 | 
						|
    client
 | 
						|
}`, true},
 | 
						|
		{`azure resource_set:zone {
 | 
						|
    client abc
 | 
						|
}`, false},
 | 
						|
		{`azure resource_set:zone {
 | 
						|
    subscription
 | 
						|
}`, true},
 | 
						|
		{`azure resource_set:zone {
 | 
						|
    subscription abc
 | 
						|
}`, false},
 | 
						|
		{`azure resource_set:zone {
 | 
						|
    foo
 | 
						|
}`, true},
 | 
						|
		{`azure resource_set:zone {
 | 
						|
    tenant tenant_id
 | 
						|
    client client_id
 | 
						|
    secret client_secret
 | 
						|
    subscription subscription_id
 | 
						|
    access public
 | 
						|
}`, 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 {
 | 
						|
			access private
 | 
						|
		}`, false},
 | 
						|
		{`azure resource-set:zone {
 | 
						|
			access public
 | 
						|
		}`, false},
 | 
						|
		{`azure resource-set:zone {
 | 
						|
			access foo
 | 
						|
		}`, 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)
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 |