From 5ae4c52ca657e6776a8f7c08da8926c992eb632c Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Mon, 23 Oct 2017 10:08:34 +0200 Subject: [PATCH] Revert "local state: fix test with updated error message" This reverts commit e9149f64d9afb38246f9432edd806321c1eefb83. --- agent/local/state.go | 2 +- agent/local/state_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agent/local/state.go b/agent/local/state.go index 5058eed0bf..409e3fc175 100644 --- a/agent/local/state.go +++ b/agent/local/state.go @@ -348,7 +348,7 @@ func (l *State) AddCheck(check *structs.HealthCheck, token string) error { // if there is a serviceID associated with the check, make sure it exists before adding it // NOTE - This logic may be moved to be handled within the Agent's Addcheck method after a refactor if check.ServiceID != "" && l.services[check.ServiceID] == nil { - return fmt.Errorf("Check %q refers to non-existent service %q", check.CheckID, check.ServiceID) + return fmt.Errorf("Check %q refers to non-existent service %q does not exist", check.CheckID, check.ServiceID) } // hard-set the node name diff --git a/agent/local/state_test.go b/agent/local/state_test.go index 89136e88fe..844006fde3 100644 --- a/agent/local/state_test.go +++ b/agent/local/state_test.go @@ -1,7 +1,6 @@ package local_test import ( - "errors" "fmt" "reflect" "testing" @@ -1454,10 +1453,11 @@ func TestAgent_AddCheckFailure(t *testing.T) { ServiceID: "redis", Status: api.HealthPassing, } - wantErr := errors.New(`Check "redis:1" refers to non-existent service "redis"`) - if got, want := l.AddCheck(chk, ""), wantErr; !reflect.DeepEqual(got, want) { - t.Fatalf("got error %q want %q", got, want) + 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) } + } func TestAgent_sendCoordinate(t *testing.T) {