mirror of https://github.com/status-im/consul.git
Unit test for failure case of AddCheck
This commit is contained in:
parent
0047b7d3f0
commit
c32e4ebe26
|
@ -1533,6 +1533,26 @@ func TestAgent_checkCriticalTime(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAgent_AddCheckFailure(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
cfg := TestConfig()
|
||||||
|
l := NewLocalState(cfg, nil)
|
||||||
|
|
||||||
|
// Add a check for a service that does not exist and verify that it fails
|
||||||
|
checkID := types.CheckID("redis:1")
|
||||||
|
chk := &structs.HealthCheck{
|
||||||
|
Node: "node",
|
||||||
|
CheckID: checkID,
|
||||||
|
Name: "redis:1",
|
||||||
|
ServiceID: "redis",
|
||||||
|
Status: api.HealthPassing,
|
||||||
|
}
|
||||||
|
if err := l.AddCheck(chk, ""); err == nil {
|
||||||
|
t.Fatalf("Expected error when adding a check for a non-existent service")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func TestAgent_nestedPauseResume(t *testing.T) {
|
func TestAgent_nestedPauseResume(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
l := new(localState)
|
l := new(localState)
|
||||||
|
|
Loading…
Reference in New Issue