Made unit test for AddCheck error check the actual error string

This commit is contained in:
Preetha Appan 2017-07-19 11:00:56 -05:00
parent 00c4a891d7
commit 9116186b4c
1 changed files with 3 additions and 2 deletions

View File

@ -1547,8 +1547,9 @@ func TestAgent_AddCheckFailure(t *testing.T) {
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")
expectedErr := "ServiceID \"redis\" does not exist"
if err := l.AddCheck(chk, ""); err == nil || expectedErr != err.Error() {
t.Fatalf("Expected error when adding a check for a non-existent service but got %v", err)
}
}