open-consul/consul/config_test.go
2017-05-31 00:29:26 +02:00

22 lines
458 B
Go

package consul
import (
"testing"
)
func TestConfig_GetTokenForAgent(t *testing.T) {
t.Parallel()
config := DefaultConfig()
if token := config.GetTokenForAgent(); token != "" {
t.Fatalf("bad: %s", token)
}
config.ACLToken = "hello"
if token := config.GetTokenForAgent(); token != "hello" {
t.Fatalf("bad: %s", token)
}
config.ACLAgentToken = "world"
if token := config.GetTokenForAgent(); token != "world" {
t.Fatalf("bad: %s", token)
}
}