From ac02cfcb798f0771fb691b7eba4096d63ae92351 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 9 Mar 2022 22:21:29 +0000 Subject: [PATCH] notifier: in tests use labels.FromStrings Replacing code which assumes the internal structure of `Labels`. Signed-off-by: Bryan Boreham --- notifier/notifier_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index cb44cdda5..66ee45c6e 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -243,7 +243,7 @@ func TestCustomDo(t *testing.T) { func TestExternalLabels(t *testing.T) { h := NewManager(&Options{ QueueCapacity: 3 * maxBatchSize, - ExternalLabels: labels.Labels{{Name: "a", Value: "b"}}, + ExternalLabels: labels.FromStrings("a", "b"), RelabelConfigs: []*relabel.Config{ { SourceLabels: model.LabelNames{"alertname"}, @@ -570,7 +570,7 @@ func makeInputTargetGroup() *targetgroup.Group { } func TestLabelsToOpenAPILabelSet(t *testing.T) { - require.Equal(t, models.LabelSet{"aaa": "111", "bbb": "222"}, labelsToOpenAPILabelSet(labels.Labels{{Name: "aaa", Value: "111"}, {Name: "bbb", Value: "222"}})) + require.Equal(t, models.LabelSet{"aaa": "111", "bbb": "222"}, labelsToOpenAPILabelSet(labels.FromStrings("aaa", "111", "bbb", "222"))) } // TestHangingNotifier validates that targets updates happen even when there are