From 2222509cb410a4214577a979d490de9e19e9f112 Mon Sep 17 00:00:00 2001 From: carlory Date: Fri, 21 Jul 2023 15:41:26 +0800 Subject: [PATCH] e2e_instrumentation: stop using deprecated framework.ExpectEqual --- test/e2e/instrumentation/core_events.go | 5 +++-- test/e2e/instrumentation/events.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/e2e/instrumentation/core_events.go b/test/e2e/instrumentation/core_events.go index 36e4b82236e..cc07c588411 100644 --- a/test/e2e/instrumentation/core_events.go +++ b/test/e2e/instrumentation/core_events.go @@ -31,6 +31,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/types" ) @@ -114,7 +115,7 @@ var _ = common.SIGDescribe("Events", func() { // get event by name event, err := f.ClientSet.CoreV1().Events(f.Namespace.Name).Get(ctx, eventCreatedName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to fetch the test event") - framework.ExpectEqual(event.Message, eventPatchMessage, "test event message does not match patch message") + gomega.Expect(event.Message).To(gomega.Equal(eventPatchMessage), "test event message does not match patch message") ginkgo.By("updating the test event") @@ -204,7 +205,7 @@ var _ = common.SIGDescribe("Events", func() { }) framework.ExpectNoError(err, "failed to get a list of events") - framework.ExpectEqual(len(eventList.Items), len(eventTestNames), "looking for expected number of pod templates events") + gomega.Expect(eventList.Items).To(gomega.HaveLen(len(eventTestNames)), "looking for expected number of pod templates events") ginkgo.By("delete collection of events") // delete collection diff --git a/test/e2e/instrumentation/events.go b/test/e2e/instrumentation/events.go index 749726b0d5f..553d2bb025f 100644 --- a/test/e2e/instrumentation/events.go +++ b/test/e2e/instrumentation/events.go @@ -19,7 +19,6 @@ package instrumentation import ( "context" "encoding/json" - "fmt" "time" v1 "k8s.io/api/core/v1" @@ -35,6 +34,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/types" ) @@ -218,7 +218,7 @@ var _ = common.SIGDescribe("Events API", func() { LabelSelector: "testevent-set=true", }) framework.ExpectNoError(err, "failed to get a list of events") - framework.ExpectEqual(len(eventList.Items), len(eventNames), fmt.Sprintf("unexpected event list: %#v", eventList)) + gomega.Expect(eventList.Items).To(gomega.HaveLen(len(eventNames)), "unexpected event list: %#v", eventList) ginkgo.By("delete a list of events") framework.Logf("requesting DeleteCollection of events") @@ -232,6 +232,6 @@ var _ = common.SIGDescribe("Events API", func() { LabelSelector: "testevent-set=true", }) framework.ExpectNoError(err, "failed to get a list of events") - framework.ExpectEqual(len(eventList.Items), 0, fmt.Sprintf("unexpected event list: %#v", eventList)) + gomega.Expect(eventList.Items).To(gomega.BeEmpty(), "unexpected event list: %#v", eventList) }) })