From 578f2b797480705be99f44113c64fc6bcb780c67 Mon Sep 17 00:00:00 2001 From: Hu Shuai Date: Wed, 1 Jul 2020 15:51:32 +0800 Subject: [PATCH] Add a unit test for labelsToOpenAPILabelSet in notifier/notifier.go. (#7492) This PR is about adding a unit test for labelsToOpenAPILabelSet in notifier/notifier.go. Signed-off-by: Hu Shuai --- notifier/notifier_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index 95c642b363..5c39afcd2b 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -27,6 +27,7 @@ import ( "time" "github.com/pkg/errors" + "github.com/prometheus/alertmanager/api/v2/models" config_util "github.com/prometheus/common/config" "github.com/prometheus/common/model" yaml "gopkg.in/yaml.v2" @@ -556,3 +557,7 @@ func makeInputTargetGroup() *targetgroup.Group { Source: "testsource", } } + +func TestLabelsToOpenAPILabelSet(t *testing.T) { + testutil.Equals(t, models.LabelSet{"aaa": "111", "bbb": "222"}, labelsToOpenAPILabelSet(labels.Labels{{Name: "aaa", Value: "111"}, {Name: "bbb", Value: "222"}})) +}