lib/promscrape/discovery/kubernetes: deflake tests; a follow-up for 05fb08713c

This commit is contained in:
Aliaksandr Valialkin 2021-03-01 14:31:28 +02:00
parent c3bf72992f
commit b89a4fac2f
5 changed files with 5 additions and 10 deletions

View file

@ -1,7 +1,6 @@
package kubernetes package kubernetes
import ( import (
"reflect"
"testing" "testing"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
@ -107,7 +106,7 @@ func TestParseEndpointsListSuccess(t *testing.T) {
"__meta_kubernetes_namespace": "default", "__meta_kubernetes_namespace": "default",
}), }),
} }
if !reflect.DeepEqual(sortedLabelss, expectedLabelss) { if !areEqualLabelss(sortedLabelss, expectedLabelss) {
t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss) t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss)
} }
} }

View file

@ -1,7 +1,6 @@
package kubernetes package kubernetes
import ( import (
"reflect"
"testing" "testing"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
@ -282,7 +281,7 @@ func TestParseEndpointSliceListSuccess(t *testing.T) {
"__meta_kubernetes_namespace": "kube-system", "__meta_kubernetes_namespace": "kube-system",
}), }),
} }
if !reflect.DeepEqual(sortedLabelss, expectedLabelss) { if !areEqualLabelss(sortedLabelss, expectedLabelss) {
t.Fatalf("unexpected labels,\ngot:\n%v,\nwant:\n%v", sortedLabelss, expectedLabelss) t.Fatalf("unexpected labels,\ngot:\n%v,\nwant:\n%v", sortedLabelss, expectedLabelss)
} }

View file

@ -1,7 +1,6 @@
package kubernetes package kubernetes
import ( import (
"reflect"
"testing" "testing"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
@ -92,7 +91,7 @@ func TestParseIngressListSuccess(t *testing.T) {
"__meta_kubernetes_namespace": "default", "__meta_kubernetes_namespace": "default",
}), }),
} }
if !reflect.DeepEqual(sortedLabelss, expectedLabelss) { if !areEqualLabelss(sortedLabelss, expectedLabelss) {
t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss) t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss)
} }
} }

View file

@ -1,7 +1,6 @@
package kubernetes package kubernetes
import ( import (
"reflect"
"testing" "testing"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
@ -274,7 +273,7 @@ func TestParsePodListSuccess(t *testing.T) {
"__meta_kubernetes_pod_annotationpresent_kubernetes_io_config_source": "true", "__meta_kubernetes_pod_annotationpresent_kubernetes_io_config_source": "true",
}), }),
} }
if !reflect.DeepEqual(sortedLabelss, expectedLabelss) { if !areEqualLabelss(sortedLabelss, expectedLabelss) {
t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss) t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss)
} }
} }

View file

@ -1,7 +1,6 @@
package kubernetes package kubernetes
import ( import (
"reflect"
"testing" "testing"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
@ -169,7 +168,7 @@ func TestParseServiceListSuccess(t *testing.T) {
"__meta_kubernetes_service_annotationpresent_prometheus_io_scrape": "true", "__meta_kubernetes_service_annotationpresent_prometheus_io_scrape": "true",
}), }),
} }
if !reflect.DeepEqual(sortedLabelss, expectedLabelss) { if !areEqualLabelss(sortedLabelss, expectedLabelss) {
t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss) t.Fatalf("unexpected labels:\ngot\n%v\nwant\n%v", sortedLabelss, expectedLabelss)
} }
} }