Files
coredns/plugin/traffic/setup_test.go
Miek Gieben d5c5ba010c Add traffic plugin
This allows for advanced loadbalancing and maybe geoIP loadbalancing.

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-01-09 17:07:22 +01:00

35 lines
632 B
Go

package traffic
import (
"testing"
"github.com/caddyserver/caddy"
)
func TestSetup(t *testing.T) {
tests := []struct {
input string
shouldErr bool
}{
// positive
{`traffic`, false},
// negative
{`traffic fleeb`, true},
}
for i, test := range tests {
c := caddy.NewTestController("dns", test.input)
err := parse(c)
if test.shouldErr && err == nil {
t.Errorf("Test %d: Expected error but found %s for input %s", i, err, test.input)
}
if err != nil {
if !test.shouldErr {
t.Errorf("Test %d: Expected no error but found one for input %s. Error was: %v", i, test.input, err)
}
}
}
}