You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/command/agent/command_test.go

34 lines
569 B

package agent
import (
"github.com/mitchellh/cli"
"testing"
)
func TestCommand_implements(t *testing.T) {
var _ cli.Command = new(Command)
}
func TestValidDatacenter(t *testing.T) {
shouldMatch := []string{
"dc1",
"east-aws-001",
"PROD_aws01-small",
}
noMatch := []string{
"east.aws",
"east!aws",
"first,second",
}
for _, m := range shouldMatch {
if !validDatacenter.MatchString(m) {
t.Fatalf("expected match: %s", m)
}
}
for _, m := range noMatch {
if validDatacenter.MatchString(m) {
t.Fatalf("expected no match: %s", m)
}
}
}