mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 00:01:35 +01:00 
			
		
		
		
	* plugin/azure: fix bug in setting up plugin Signed-off-by: darshanime <deathbullet@gmail.com> * plugin/azure: add support for private zones Signed-off-by: darshanime <deathbullet@gmail.com> * plugin/azure: change syntax for access level Signed-off-by: darshanime <deathbullet@gmail.com> * plugin/azure: change import alias for azure dns Signed-off-by: darshanime <deathbullet@gmail.com> * plugin/azure: reword readme, var names Signed-off-by: darshanime <deathbullet@gmail.com> * plugin/azure: remove newline in imports Signed-off-by: darshanime <deathbullet@gmail.com> * fix import grouping Co-authored-by: Chris O'Haver <cohaver@infoblox.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 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)
 | |
| 		}
 | |
| 	}
 | |
| }
 |