Skip to content

fix(test): avoid NPE on missing status in WorkflowAllFeatureIT - #3736

Merged
csviri merged 1 commit into
operator-framework:mainfrom
csviri:fix/workflow-all-feature-it-null-status
Dec 1, 2026
Merged

csviri merged 1 commit into
operator-framework:mainfrom
csviri:fix/workflow-all-feature-it-null-status

Conversation

@csviri

@csviri csviri commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

WorkflowAllFeatureIT.configMapNotReconciledUntilDeploymentReady fails intermittently in CI with:

NullPointerException: Cannot invoke "WorkflowAllFeatureStatus.getMsgFromCondition()"
because the return value of "WorkflowAllFeatureIT.getPrimaryStatus()" is null

The reconciler increments its execution counter at the start of reconcile(), but the status patch is only applied after it returns. In the gap between the Deployment being created and the status patch landing, the first await condition sees a positive count, an existing Deployment, no ConfigMap and a null status. The resulting NPE is not an AssertionError, so Awaitility fails the test straight away instead of polling again. In the failing run the test died about 1s in, well within the 10s timeout.

This PR asserts that the status is not null before dereferencing it, in both await blocks, so the condition is retried until the patch is visible. The other tests in the class already do this.

Test-only change. I verified it with spotless:check and test-compile; I did not run the IT locally because it needs a cluster.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added checks to ensure the primary status is present before validating its condition message and readiness.

The reconciliation counter is incremented at the start of reconcile(),
before the status patch is applied, so the await condition could see a
positive count, an existing Deployment and a still-null status. The
resulting NullPointerException is not an AssertionError, so Awaitility
fails immediately instead of polling again. Assert the status is not
null first so the condition is retried until the patch lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 08:08
@openshift-ci
openshift-ci Bot requested review from metacosm and xstefank December 1, 2026 08:08
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The workflow integration test now checks that the primary status is non-null before reading its condition message and before asserting readiness.

Changes: Workflow status assertions

Layer / File(s) Summary
Primary status checks
operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/workflowallfeature/WorkflowAllFeatureIT.java
The test stores the primary status before checking its condition message. It also checks that the status is non-null before asserting readiness.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested labels: java

Suggested reviewers: metacosm, xstefank

Merge Risk: Minimal · up to 9e507

This test-only change makes a flaky integration test retry while the status is not yet available. It has no production impact and is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: a null-status check in the WorkflowAllFeatureIT test to avoid a NullPointerException. The raw summary confirms the test file gains non-null checks on the primary status in …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: a null-status check in the WorkflowAllFeatureIT test to avoid a NullPointerException. The raw summary confirms the test file gains non-null checks on the primary status in both await blocks, and the objectives describe the same guard. The title uses the conventional fix(test) prefix and is specific enough for a reviewer to see the main change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 78eaffca-03f6-40e4-86da-00711a4fb328
Commits

Reviewing files that changed from the base of the PR and between 07e1af3 and 9e507aa.

Files selected for processing: 1

  • operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/workflowallfeature/WorkflowAllFeatureIT.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the test-only change adding null-status guards to the polling assertions.

No open issues 🎉

What changed in this PR

This test-only change prevents intermittent null-pointer failures in WorkflowAllFeatureIT while reconciliation status is still being published.

Changes:

  • Adds non-null status assertions in both polling blocks so Awaitility retries instead of failing immediately.
  • Stores the first block’s status lookup locally before checking its fields.
File Description
operator-framework/​src/​test/​java/​io/​javaoperatorsdk/​operator/​workflow/​workflowallfeature/​WorkflowAllFeatureIT.java Guards status reads in configMapNotReconciledUntilDeploymentReady against delayed status publication.

Review effort: Balanced

@csviri
csviri merged commit cee2934 into operator-framework:main Dec 1, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants