mirror of https://github.com/hashicorp/consul
Fixes up some broken unit tests.
parent
8940d1c3fe
commit
7ce7d157da
|
@ -519,11 +519,6 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
|
||||||
t.Fatalf("err: %v", err)
|
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)
|
// Create service (disallowed)
|
||||||
srv1 := &structs.NodeService{
|
srv1 := &structs.NodeService{
|
||||||
ID: "mysql",
|
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) {
|
func TestAgentAntiEntropy_Checks(t *testing.T) {
|
||||||
|
@ -900,11 +900,6 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
|
||||||
t.Fatalf("err: %v", err)
|
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
|
// Create services using the root token
|
||||||
srv1 := &structs.NodeService{
|
srv1 := &structs.NodeService{
|
||||||
ID: "mysql",
|
ID: "mysql",
|
||||||
|
@ -1111,6 +1106,11 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
|
||||||
t.Fatalf("should be in sync: %v %v", name, status)
|
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) {
|
func TestAgentAntiEntropy_Check_DeferSync(t *testing.T) {
|
||||||
|
@ -1419,9 +1419,9 @@ func TestAgent_serviceTokens(t *testing.T) {
|
||||||
t.Fatalf("bad: %s", token)
|
t.Fatalf("bad: %s", token)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes token
|
// Keeps token around for the delete
|
||||||
l.RemoveService("redis")
|
l.RemoveService("redis")
|
||||||
if token := l.ServiceToken("redis"); token != "default" {
|
if token := l.ServiceToken("redis"); token != "abc123" {
|
||||||
t.Fatalf("bad: %s", token)
|
t.Fatalf("bad: %s", token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1443,9 +1443,9 @@ func TestAgent_checkTokens(t *testing.T) {
|
||||||
t.Fatalf("bad: %s", token)
|
t.Fatalf("bad: %s", token)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes token
|
// Keeps token around for the delete
|
||||||
l.RemoveCheck("mem")
|
l.RemoveCheck("mem")
|
||||||
if token := l.CheckToken("mem"); token != "default" {
|
if token := l.CheckToken("mem"); token != "abc123" {
|
||||||
t.Fatalf("bad: %s", token)
|
t.Fatalf("bad: %s", token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue