From dde904b57da761b19d04d4a4509f8d3bf65b3038 Mon Sep 17 00:00:00 2001 From: Nikhil Sharma Date: Sat, 13 Nov 2021 00:57:55 +0530 Subject: [PATCH] Changed code to improve output for files under test/e2e/instrumentation --- test/e2e/instrumentation/core_events.go | 8 ++++++-- test/e2e/instrumentation/events.go | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/e2e/instrumentation/core_events.go b/test/e2e/instrumentation/core_events.go index 2d2b2d565b0..9be6f06ea6e 100644 --- a/test/e2e/instrumentation/core_events.go +++ b/test/e2e/instrumentation/core_events.go @@ -84,7 +84,9 @@ var _ = common.SIGDescribe("Events", func() { break } } - framework.ExpectEqual(foundCreatedEvent, true, "unable to find the test event") + if !foundCreatedEvent { + framework.Failf("unable to find test event %s in namespace %s, full list of events is %+v", eventTestName, f.Namespace.Name, eventsList.Items) + } ginkgo.By("patching the test event") // patch the event's message @@ -121,7 +123,9 @@ var _ = common.SIGDescribe("Events", func() { break } } - framework.ExpectEqual(foundCreatedEvent, false, "should not have found test event after deletion") + if foundCreatedEvent { + framework.Failf("Should not have found test event %s in namespace %s, full list of events %+v", eventTestName, f.Namespace.Name, eventsList.Items) + } }) /* diff --git a/test/e2e/instrumentation/events.go b/test/e2e/instrumentation/events.go index 74e28befb21..6bf442e9e22 100644 --- a/test/e2e/instrumentation/events.go +++ b/test/e2e/instrumentation/events.go @@ -101,11 +101,15 @@ var _ = common.SIGDescribe("Events API", func() { ginkgo.By("listing events in all namespaces") foundCreatedEvent := eventExistsInList(clientAllNamespaces, f.Namespace.Name, eventName) - framework.ExpectEqual(foundCreatedEvent, true, "failed to find test event in list with cluster scope") + if !foundCreatedEvent { + framework.Failf("Failed to find test event %s in namespace %s, in list with cluster scope", eventName, f.Namespace.Name) + } ginkgo.By("listing events in test namespace") foundCreatedEvent = eventExistsInList(client, f.Namespace.Name, eventName) - framework.ExpectEqual(foundCreatedEvent, true, "failed to find test event in list with namespace scope") + if !foundCreatedEvent { + framework.Failf("Failed to find test event %s in namespace %s, in list with namespace scope", eventName, f.Namespace.Name) + } ginkgo.By("listing events with field selection filtering on source") filteredCoreV1List, err := coreClient.List(context.TODO(), metav1.ListOptions{FieldSelector: "source=test-controller"}) @@ -172,11 +176,15 @@ var _ = common.SIGDescribe("Events API", func() { ginkgo.By("listing events in all namespaces") foundCreatedEvent = eventExistsInList(clientAllNamespaces, f.Namespace.Name, eventName) - framework.ExpectEqual(foundCreatedEvent, false, "should not have found test event after deletion") + if foundCreatedEvent { + framework.Failf("Should not have found test event %s in namespace %s, in list with cluster scope after deletion", eventName, f.Namespace.Name) + } ginkgo.By("listing events in test namespace") foundCreatedEvent = eventExistsInList(client, f.Namespace.Name, eventName) - framework.ExpectEqual(foundCreatedEvent, false, "should not have found test event after deletion") + if foundCreatedEvent { + framework.Failf("Should not have found test event %s in namespace %s, in list with namespace scope after deletion", eventName, f.Namespace.Name) + } }) /*