From 8192242052bad198346054230c191e80e78bfcc7 Mon Sep 17 00:00:00 2001 From: Catherine Fang Date: Mon, 6 May 2024 14:01:23 -0400 Subject: [PATCH] Update test to sort map --- .../pkg/adapter/coreprovider/coreprovider_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom-metrics-stackdriver-adapter/pkg/adapter/coreprovider/coreprovider_test.go b/custom-metrics-stackdriver-adapter/pkg/adapter/coreprovider/coreprovider_test.go index 1e748f61b..a29c5deae 100644 --- a/custom-metrics-stackdriver-adapter/pkg/adapter/coreprovider/coreprovider_test.go +++ b/custom-metrics-stackdriver-adapter/pkg/adapter/coreprovider/coreprovider_test.go @@ -759,7 +759,7 @@ func TestCoreprovider_GetPodMetrics_Many(t *testing.T) { t.Fatalf("Unexpected result. Expected len: \n%v,\n received: \n%v", len(expectedPodMetrics), len(podMetrics)) } - if diff := cmp.Diff(expectedPodMetrics, podMetrics, cmpopts.SortMaps(func(a, b string) bool { return a < b }), cmpopts.IgnoreFields(metrics.PodMetrics{}, "ObjectMeta", "CreationTimestamp")); diff != "" { + if diff := cmp.Diff(expectedPodMetrics, podMetrics, cmpopts.SortMaps(func(a, b metrics.ContainerMetrics) bool { return a.Name < b.Name }), cmpopts.IgnoreFields(metrics.PodMetrics{}, "ObjectMeta", "CreationTimestamp")); diff != "" { t.Errorf("Has a diff, (-want, +got): %s. Want: %v, got: %v.", diff, expectedPodMetrics, podMetrics) }