Skip to content

Commit c83ab8b

Browse files
committed
test: fix flaky ManualObservedGenerationIT by guarding null status
The status assertions could throw NPE on the first Awaitility poll before the reconciler patched the status. untilAsserted retries AssertionErrors but rethrows other exceptions immediately, so the NPE aborted the test instead of retrying. Guard with assertThat(status).isNotNull() to keep polling. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent c5c9e8f commit c83ab8b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/manualobservedgeneration/ManualObservedGenerationIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void observedGenerationUpdated() {
5252
() -> {
5353
var r = extension.get(ManualObservedGenerationCustomResource.class, RESOURCE_NAME);
5454
assertThat(r).isNotNull();
55+
assertThat(r.getStatus()).isNotNull();
5556
assertThat(r.getStatus().getObservedGeneration()).isEqualTo(1);
5657
assertThat(r.getStatus().getObservedGeneration())
5758
.isEqualTo(r.getMetadata().getGeneration());
@@ -65,6 +66,8 @@ void observedGenerationUpdated() {
6566
.untilAsserted(
6667
() -> {
6768
var r = extension.get(ManualObservedGenerationCustomResource.class, RESOURCE_NAME);
69+
assertThat(r).isNotNull();
70+
assertThat(r.getStatus()).isNotNull();
6871
assertThat(r.getStatus().getObservedGeneration()).isEqualTo(2);
6972
assertThat(r.getStatus().getObservedGeneration())
7073
.isEqualTo(r.getMetadata().getGeneration());

0 commit comments

Comments
 (0)