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 <hus.fnst@cn.fujitsu.com>
This commit is contained in:
Hu Shuai 2020-07-01 15:51:32 +08:00 committed by GitHub
parent 72425d4e3d
commit 578f2b7974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"}}))
}