2016-12-11 19:24:44 +00:00
|
|
|
package consul
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfig_GetTokenForAgent(t *testing.T) {
|
2017-05-22 22:14:27 +00:00
|
|
|
t.Parallel()
|
2016-12-11 19:24:44 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|