Skip to content

Commit 2fbe301

Browse files
authored
Merge pull request kubernetes#93296 from chelseychen/event-e2e-conformance
Add conformance test for events Update operation
2 parents ae7dce7 + 5b1bdd8 commit 2fbe301

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

test/conformance/testdata/conformance.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,8 @@
15151515
codename: '[sig-instrumentation] Events API should ensure that an event can be fetched,
15161516
patched, deleted, and listed [Conformance]'
15171517
description: Create an event, the event MUST exist. The event is patched with a
1518-
new note, the check MUST have the update note. The event is deleted and MUST NOT
1518+
new note, the check MUST have the update note. The event is updated with a new
1519+
series, the check MUST have the update series. The event is deleted and MUST NOT
15191520
show up when listing all events.
15201521
release: v1.19
15211522
file: test/e2e/instrumentation/events.go

test/e2e/instrumentation/events.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ var _ = common.SIGDescribe("Events API", func() {
8989
Testname: New Event resource lifecycle, testing a single event
9090
Description: Create an event, the event MUST exist.
9191
The event is patched with a new note, the check MUST have the update note.
92+
The event is updated with a new series, the check MUST have the update series.
9293
The event is deleted and MUST NOT show up when listing all events.
9394
*/
9495
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() {
147148
framework.Failf("test event wasn't properly patched: %v", diff.ObjectReflectDiff(testEvent, event))
148149
}
149150

151+
ginkgo.By("updating the test event")
152+
testEvent.Series = &eventsv1.EventSeries{
153+
Count: 100,
154+
LastObservedTime: metav1.MicroTime{Time: time.Unix(1505828956, 0)},
155+
}
156+
_, err = client.Update(context.TODO(), testEvent, metav1.UpdateOptions{})
157+
framework.ExpectNoError(err, "failed to update the test event")
158+
159+
ginkgo.By("getting the test event")
160+
event, err = client.Get(context.TODO(), eventName, metav1.GetOptions{})
161+
framework.ExpectNoError(err, "failed to get test event")
162+
// clear ResourceVersion and ManagedFields which are set by control-plane
163+
event.ObjectMeta.ResourceVersion = ""
164+
event.ObjectMeta.ManagedFields = nil
165+
if !apiequality.Semantic.DeepEqual(testEvent, event) {
166+
framework.Failf("test event wasn't properly updated: %v", diff.ObjectReflectDiff(testEvent, event))
167+
}
168+
150169
ginkgo.By("deleting the test event")
151170
err = client.Delete(context.TODO(), eventName, metav1.DeleteOptions{})
152171
framework.ExpectNoError(err, "failed to delete the test event")

0 commit comments

Comments
 (0)