mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -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>
		
			
				
	
	
		
			82 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package route53
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/coredns/caddy"
 | 
						|
 | 
						|
	"github.com/aws/aws-sdk-go/aws/credentials"
 | 
						|
	"github.com/aws/aws-sdk-go/service/route53/route53iface"
 | 
						|
)
 | 
						|
 | 
						|
func TestSetupRoute53(t *testing.T) {
 | 
						|
	f = func(credential *credentials.Credentials) route53iface.Route53API {
 | 
						|
		return fakeRoute53{}
 | 
						|
	}
 | 
						|
 | 
						|
	tests := []struct {
 | 
						|
		body          string
 | 
						|
		expectedError bool
 | 
						|
	}{
 | 
						|
		{`route53`, false},
 | 
						|
		{`route53 :`, true},
 | 
						|
		{`route53 example.org:12345678`, false},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
    aws_access_key
 | 
						|
}`, true},
 | 
						|
		{`route53 example.org:12345678 { }`, false},
 | 
						|
 | 
						|
		{`route53 example.org:12345678 { }`, false},
 | 
						|
		{`route53 example.org:12345678 { wat
 | 
						|
}`, true},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
    aws_access_key ACCESS_KEY_ID SEKRIT_ACCESS_KEY
 | 
						|
}`, false},
 | 
						|
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
    fallthrough
 | 
						|
}`, false},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
		credentials
 | 
						|
	}`, true},
 | 
						|
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
		credentials default
 | 
						|
	}`, false},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
		credentials default credentials
 | 
						|
	}`, false},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
		credentials default credentials extra-arg
 | 
						|
	}`, true},
 | 
						|
		{`route53 example.org:12345678 example.org:12345678 {
 | 
						|
	}`, true},
 | 
						|
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
	refresh 90
 | 
						|
}`, false},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
	refresh 5m
 | 
						|
}`, false},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
	refresh
 | 
						|
}`, true},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
	refresh foo
 | 
						|
}`, true},
 | 
						|
		{`route53 example.org:12345678 {
 | 
						|
	refresh -1m
 | 
						|
}`, true},
 | 
						|
 | 
						|
		{`route53 example.org {
 | 
						|
	}`, true},
 | 
						|
	}
 | 
						|
 | 
						|
	for _, test := range tests {
 | 
						|
		c := caddy.NewTestController("dns", test.body)
 | 
						|
		if err := setup(c); (err == nil) == test.expectedError {
 | 
						|
			t.Errorf("Unexpected errors: %v", err)
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 |