From b89a4fac2f8fed452c8dcfd338561cbd78495016 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 1 Mar 2021 14:31:28 +0200 Subject: [PATCH] lib/promscrape/discovery/kubernetes: deflake tests; a follow-up for 05fb08713cdbbe48c750c12060e790fecdc9a9b4 --- lib/promscrape/discovery/kubernetes/endpoints_test.go | 3 +-- lib/promscrape/discovery/kubernetes/endpointslices_test.go | 3 +-- lib/promscrape/discovery/kubernetes/ingress_test.go | 3 +-- lib/promscrape/discovery/kubernetes/pod_test.go | 3 +-- lib/promscrape/discovery/kubernetes/service_test.go | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/promscrape/discovery/kubernetes/endpoints_test.go b/lib/promscrape/discovery/kubernetes/endpoints_test.go index 05a74183b..c9649df92 100644 --- a/lib/promscrape/discovery/kubernetes/endpoints_test.go +++ b/lib/promscrape/discovery/kubernetes/endpoints_test.go @@ -1,7 +1,6 @@ package kubernetes import ( - "reflect" "testing" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" @@ -107,7 +106,7 @@ func TestParseEndpointsListSuccess(t *testing.T) { "__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) } } diff --git a/lib/promscrape/discovery/kubernetes/endpointslices_test.go b/lib/promscrape/discovery/kubernetes/endpointslices_test.go index d587fd93f..3555e42f2 100644 --- a/lib/promscrape/discovery/kubernetes/endpointslices_test.go +++ b/lib/promscrape/discovery/kubernetes/endpointslices_test.go @@ -1,7 +1,6 @@ package kubernetes import ( - "reflect" "testing" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" @@ -282,7 +281,7 @@ func TestParseEndpointSliceListSuccess(t *testing.T) { "__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) } diff --git a/lib/promscrape/discovery/kubernetes/ingress_test.go b/lib/promscrape/discovery/kubernetes/ingress_test.go index 8046d8a24..5718758f5 100644 --- a/lib/promscrape/discovery/kubernetes/ingress_test.go +++ b/lib/promscrape/discovery/kubernetes/ingress_test.go @@ -1,7 +1,6 @@ package kubernetes import ( - "reflect" "testing" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" @@ -92,7 +91,7 @@ func TestParseIngressListSuccess(t *testing.T) { "__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) } } diff --git a/lib/promscrape/discovery/kubernetes/pod_test.go b/lib/promscrape/discovery/kubernetes/pod_test.go index 204a8f102..54ebdec0f 100644 --- a/lib/promscrape/discovery/kubernetes/pod_test.go +++ b/lib/promscrape/discovery/kubernetes/pod_test.go @@ -1,7 +1,6 @@ package kubernetes import ( - "reflect" "testing" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" @@ -274,7 +273,7 @@ func TestParsePodListSuccess(t *testing.T) { "__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) } } diff --git a/lib/promscrape/discovery/kubernetes/service_test.go b/lib/promscrape/discovery/kubernetes/service_test.go index 56508e5f3..ca1570ef7 100644 --- a/lib/promscrape/discovery/kubernetes/service_test.go +++ b/lib/promscrape/discovery/kubernetes/service_test.go @@ -1,7 +1,6 @@ package kubernetes import ( - "reflect" "testing" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" @@ -169,7 +168,7 @@ func TestParseServiceListSuccess(t *testing.T) { "__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) } }