Skip to content

Commit

Permalink
test: fix Kubernetes 1.24 enforces immutable event resources
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed May 10, 2022
1 parent c958ba2 commit 0de5162
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/src/test/java/com/marcnuri/yakc/EventsV1ApiIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ void readNamespacedEvent() throws IOException {
void patchNamespacedEvent() throws IOException {
// Given
final Event patch = new Event();
patch.setReason("Reason has been patched");
patch.setMetadata(ObjectMeta.builder().generateName("patched").build());
// When
final Event result = KC.create(EventsV1Api.class)
.patchNamespacedEvent(eventName, NAMESPACE, patch).get();
// Then
assertThat(result)
.isNotNull()
.hasFieldOrPropertyWithValue("reason", "Reason has been patched")
.hasFieldOrPropertyWithValue("metadata.generateName", "patched")
.extracting("metadata.resourceVersion").asString()
.isNotEmpty()
.isNotEqualTo(event.getMetadata().getResourceVersion());
Expand All @@ -148,6 +148,7 @@ Event createEventForTest() throws IOException {
return KC.create(EventsV1Api.class).createNamespacedEvent(NAMESPACE, Event.builder()
.metadata(ObjectMeta.builder()
.name(eventName)
.generateName("to-be-patched")
.build())
.action("mock-action")
.type("Normal")
Expand Down

0 comments on commit 0de5162

Please sign in to comment.