Skip to content

Commit

Permalink
Merge pull request #3303 from hashicorp/addcheck_test
Browse files Browse the repository at this point in the history
Unit test for failure case of AddCheck
  • Loading branch information
preetapan authored Jul 19, 2017
2 parents 0047b7d + c32e4eb commit fdc73e7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions agent/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
t.Parallel()
l := new(localState)
Expand Down

0 comments on commit fdc73e7

Please sign in to comment.