Fixes up some broken unit tests.

This commit is contained in:
James Phillips 2017-03-24 17:35:07 -07:00
parent 8940d1c3fe
commit 7ce7d157da
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 14 additions and 14 deletions

View File

@ -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)
}
}