Fixes up some broken unit tests.
This commit is contained in:
parent
f2211d2489
commit
dce84379b7
|
@ -519,11 +519,6 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
// Update the agent ACL token, resume sync
|
||||
conf.ACLAgentToken = token
|
||||
agent.StartSync()
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
// Create service (disallowed)
|
||||
srv1 := &structs.NodeService{
|
||||
ID: "mysql",
|
||||
|
@ -648,6 +643,11 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the token got cleaned up.
|
||||
if token := agent.state.ServiceToken("api"); token != "" {
|
||||
t.Fatalf("bad: %s", token)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentAntiEntropy_Checks(t *testing.T) {
|
||||
|
@ -900,11 +900,6 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
// Update the agent ACL token, resume sync
|
||||
conf.ACLAgentToken = token
|
||||
agent.StartSync()
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
// Create services using the root token
|
||||
srv1 := &structs.NodeService{
|
||||
ID: "mysql",
|
||||
|
@ -1111,6 +1106,11 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
|
|||
t.Fatalf("should be in sync: %v %v", name, status)
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the token got cleaned up.
|
||||
if token := agent.state.CheckToken("api-check"); token != "" {
|
||||
t.Fatalf("bad: %s", token)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentAntiEntropy_Check_DeferSync(t *testing.T) {
|
||||
|
@ -1419,9 +1419,9 @@ func TestAgent_serviceTokens(t *testing.T) {
|
|||
t.Fatalf("bad: %s", token)
|
||||
}
|
||||
|
||||
// Removes token
|
||||
// Keeps token around for the delete
|
||||
l.RemoveService("redis")
|
||||
if token := l.ServiceToken("redis"); token != "default" {
|
||||
if token := l.ServiceToken("redis"); token != "abc123" {
|
||||
t.Fatalf("bad: %s", token)
|
||||
}
|
||||
}
|
||||
|
@ -1443,9 +1443,9 @@ func TestAgent_checkTokens(t *testing.T) {
|
|||
t.Fatalf("bad: %s", token)
|
||||
}
|
||||
|
||||
// Removes token
|
||||
// Keeps token around for the delete
|
||||
l.RemoveCheck("mem")
|
||||
if token := l.CheckToken("mem"); token != "default" {
|
||||
if token := l.CheckToken("mem"); token != "abc123" {
|
||||
t.Fatalf("bad: %s", token)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue