Add comformance test for event Update

This commit is contained in:
Chelsey Chen 2020-07-21 10:54:04 -04:00
parent b6174e605f
commit 5b1bdd8e38
2 changed files with 21 additions and 1 deletions

View File

@ -1515,7 +1515,8 @@
codename: '[sig-instrumentation] Events API should ensure that an event can be fetched, codename: '[sig-instrumentation] Events API should ensure that an event can be fetched,
patched, deleted, and listed [Conformance]' patched, deleted, and listed [Conformance]'
description: Create an event, the event MUST exist. The event is patched with a 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. show up when listing all events.
release: v1.19 release: v1.19
file: test/e2e/instrumentation/events.go file: test/e2e/instrumentation/events.go

View File

@ -89,6 +89,7 @@ var _ = common.SIGDescribe("Events API", func() {
Testname: New Event resource lifecycle, testing a single event Testname: New Event resource lifecycle, testing a single event
Description: Create an event, the event MUST exist. 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 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. 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() { 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)) 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") ginkgo.By("deleting the test event")
err = client.Delete(context.TODO(), eventName, metav1.DeleteOptions{}) err = client.Delete(context.TODO(), eventName, metav1.DeleteOptions{})
framework.ExpectNoError(err, "failed to delete the test event") framework.ExpectNoError(err, "failed to delete the test event")