mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 14:27:27 -08:00
Add some unit tests for pkg/labels/labels.go (#7347)
This PR is about adding some unit tests for pkg/labels/labels.go. Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
This commit is contained in:
parent
82c7cd320a
commit
6ff4814a49
|
@ -531,3 +531,16 @@ func TestLabels_Copy(t *testing.T) {
|
|||
func TestLabels_Map(t *testing.T) {
|
||||
testutil.Equals(t, map[string]string{"aaa": "111", "bbb": "222"}, Labels{{"aaa", "111"}, {"bbb", "222"}}.Map())
|
||||
}
|
||||
|
||||
func TestLabels_WithLabels(t *testing.T) {
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {"ccc", "333"}}.WithLabels("aaa", "bbb"))
|
||||
}
|
||||
|
||||
func TestLabels_WithoutLabels(t *testing.T) {
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {"ccc", "333"}}.WithoutLabels("bbb", "ccc"))
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}}, Labels{{"aaa", "111"}, {"bbb", "222"}, {MetricName, "333"}}.WithoutLabels("bbb"))
|
||||
}
|
||||
|
||||
func TestLabels_FromStrings(t *testing.T) {
|
||||
testutil.Equals(t, Labels{{"aaa", "111"}, {"bbb", "222"}}, FromStrings("aaa", "111", "bbb", "222"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue