From d7913c9a807510d16bb16d516c103de633ee59f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 3 Mar 2018 14:05:49 -0800 Subject: [PATCH 1/2] Use the correct variable in tests 'es.JiraURL == es.JiraURL' is always true, it should compare es with gs. Fix it and reformat for readability --- api_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api_test.go b/api_test.go index 0b3f70c78..c9875720a 100644 --- a/api_test.go +++ b/api_test.go @@ -870,7 +870,10 @@ func testAlert(version string, t *testing.T, expectedAlert, gotAlert models.Aler for _, es := range expectedAM.Silences { foundSilence := false for _, gs := range gotAM.Silences { - if es.Comment == gs.Comment && es.CreatedBy == gs.CreatedBy && es.JiraID == gs.JiraID && es.JiraURL == es.JiraURL { + if es.Comment == gs.Comment && + es.CreatedBy == gs.CreatedBy && + es.JiraID == gs.JiraID && + es.JiraURL == gs.JiraURL { foundSilence = true } } From deebde7b0c9ac279499ba37407ad97d486475b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 3 Mar 2018 14:06:08 -0800 Subject: [PATCH 2/2] Comment out dead condition --- api_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api_test.go b/api_test.go index c9875720a..9fed9645d 100644 --- a/api_test.go +++ b/api_test.go @@ -894,11 +894,11 @@ func testAlert(version string, t *testing.T, expectedAlert, gotAlert models.Aler } func testAlertGroup(version string, t *testing.T, testCase groupTest, group models.AlertGroup) { - if testCase.hash != group.Hash { - // FIXME this is different per mock version due to startsAt / endsAt - // t.Errorf("[%s] Alert group.Hash mismatch, expected '%s' but got '%s' for group %v", - // version, testCase.hash, group.Hash, group.Labels) - } + //if testCase.hash != group.Hash { + // FIXME this is different per mock version due to startsAt / endsAt + // t.Errorf("[%s] Alert group.Hash mismatch, expected '%s' but got '%s' for group %v", + // version, testCase.hash, group.Hash, group.Labels) + //} if testCase.id != group.ID { t.Errorf("[%s] Alert group.ID mismatch, expected '%s' but got '%s' for group %v", version, testCase.id, group.ID, group.Labels)