From 5b1bdd8e3879b91867aa8f196e0927f7afa03575 Mon Sep 17 00:00:00 2001 From: Chelsey Chen Date: Tue, 21 Jul 2020 10:54:04 -0400 Subject: [PATCH] Add comformance test for event Update --- test/conformance/testdata/conformance.yaml | 3 ++- test/e2e/instrumentation/events.go | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/test/conformance/testdata/conformance.yaml b/test/conformance/testdata/conformance.yaml index c587797d70c..0295aac03b2 100755 --- a/test/conformance/testdata/conformance.yaml +++ b/test/conformance/testdata/conformance.yaml @@ -1515,7 +1515,8 @@ codename: '[sig-instrumentation] Events API should ensure that an event can be fetched, patched, deleted, and listed [Conformance]' description: Create an event, the event MUST exist. The event is patched with a - new note, the check MUST have the update note. The event is deleted and MUST NOT + new note, the check MUST have the update note. The event is updated with a new + series, the check MUST have the update series. The event is deleted and MUST NOT show up when listing all events. release: v1.19 file: test/e2e/instrumentation/events.go diff --git a/test/e2e/instrumentation/events.go b/test/e2e/instrumentation/events.go index 98db0f9164c..14dc22b366c 100644 --- a/test/e2e/instrumentation/events.go +++ b/test/e2e/instrumentation/events.go @@ -89,6 +89,7 @@ var _ = common.SIGDescribe("Events API", func() { Testname: New Event resource lifecycle, testing a single event Description: Create an event, the event MUST exist. The event is patched with a new note, the check MUST have the update note. + The event is updated with a new series, the check MUST have the update series. The event is deleted and MUST NOT show up when listing all events. */ framework.ConformanceIt("should ensure that an event can be fetched, patched, deleted, and listed", func() { @@ -147,6 +148,24 @@ var _ = common.SIGDescribe("Events API", func() { framework.Failf("test event wasn't properly patched: %v", diff.ObjectReflectDiff(testEvent, event)) } + ginkgo.By("updating the test event") + testEvent.Series = &eventsv1.EventSeries{ + Count: 100, + LastObservedTime: metav1.MicroTime{Time: time.Unix(1505828956, 0)}, + } + _, err = client.Update(context.TODO(), testEvent, metav1.UpdateOptions{}) + framework.ExpectNoError(err, "failed to update the test event") + + ginkgo.By("getting the test event") + event, err = client.Get(context.TODO(), eventName, metav1.GetOptions{}) + framework.ExpectNoError(err, "failed to get test event") + // clear ResourceVersion and ManagedFields which are set by control-plane + event.ObjectMeta.ResourceVersion = "" + event.ObjectMeta.ManagedFields = nil + if !apiequality.Semantic.DeepEqual(testEvent, event) { + framework.Failf("test event wasn't properly updated: %v", diff.ObjectReflectDiff(testEvent, event)) + } + ginkgo.By("deleting the test event") err = client.Delete(context.TODO(), eventName, metav1.DeleteOptions{}) framework.ExpectNoError(err, "failed to delete the test event")