Skip to content

fix(test): wait for ConfigMaps before updating them in MultipleSecondaryEventSourceIT - #3739

Merged
csviri merged 1 commit into
operator-framework:mainfrom
csviri:fix/multiple-secondary-event-source-it-race
Dec 3, 2026
Merged

csviri merged 1 commit into
operator-framework:mainfrom
csviri:fix/multiple-secondary-event-source-it-race

Conversation

@csviri

@csviri csviri commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

MultipleSecondaryEventSourceIT.receivingPeriodicEvents fails intermittently in CI (example run, from #3733):

NullPointerException: Cannot invoke "ConfigMap.getData()" because "map1" is null
  at MultipleSecondaryEventSourceIT.updateConfigMap(MultipleSecondaryEventSourceIT.java:81)

The first wait in the test is:

await().pollDelay(Duration.ofMillis(300)).until(() -> reconciler.getNumberOfExecutions() <= 3);

<= 3 is already true while the reconciler has not run, so this always returns once the 300ms poll delay is over. The test then reads the ConfigMaps that the first reconciliation creates. In the failing run that reconciliation started at 12:08:19.123 and was still running when the test read testresource1 at around 12:08:19.43. The ConfigMap didn't exist yet, so the test hit the NPE.

This PR waits until both ConfigMaps exist before the existing wait and before the baseline execution count is taken. The rest of the test is unchanged.

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
    • Improved test reliability by waiting for both expected resources to become available before checking execution counts.

…aryEventSourceIT

The initial await used `getNumberOfExecutions() <= 3`, which already
holds while the reconciler has not run at all, so it only ever waited
for the 300ms poll delay. On a slow runner the first reconciliation had
not created the ConfigMaps yet, and updateConfigMap failed with a
NullPointerException on the missing ConfigMap. Wait until both
ConfigMaps exist before taking the baseline execution count.

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 3, 2026 08:47
@openshift-ci
openshift-ci Bot requested review from metacosm and xstefank December 3, 2026 08:47
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The integration test now waits until both expected ConfigMaps are available before checking reconciler execution counts.

Changes: Secondary resource integration test

Layer / File(s) Summary
Wait for secondary resources
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.java
The test uses AssertJ assertions to wait until both named ConfigMaps are non-null before checking reconciler execution counts.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: xstefank

Merge Risk: Minimal · up to dd137

This is a test-only change that fixes an intermittent null-pointer failure in an integration test by waiting for the expected resources to exist. It has no production impact and carries minimal merge risk.

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 test fix that waits for ConfigMaps before updating them in MultipleSecondaryEventSourceIT. The raw summary says the test now waits until both expected ConfigMaps can be r…
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 test fix that waits for ConfigMaps before updating them in MultipleSecondaryEventSourceIT. The raw summary says the test now waits until both expected ConfigMaps can be retrieved before the existing execution-count checks, and the objectives say the change addresses intermittent NullPointerExceptions by waiting for both ConfigMaps to exist. The title is specific and matches the main change. Its wording about updating is slightly loose, since the summary describes waiting before reads, but the title still covers the primary change. The title is 85 characters, slightly longer than ideal, which does not affect the assessment.

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: 55fa8254-f2b4-4187-84b1-8f5ca2da5ac1
Commits

Reviewing files that changed from the base of the PR and between 2654109 and dd13781.

Files selected for processing: 1

  • operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.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 with the added wait for both ConfigMaps to exist before proceeding.

No open issues 🎉

What changed in this PR

Addresses an intermittent null-pointer failure in MultipleSecondaryEventSourceIT by waiting for both ConfigMaps to exist before proceeding.

Changes:

  • Adds an Awaitility check with AssertJ non-null assertions for both ConfigMaps.
  • Leaves the existing execution-count wait and subsequent test logic unchanged.
File Description
operator-framework/​src/​test/​java/​io/​javaoperatorsdk/​operator/​baseapi/​multiplesecondaryeventsource/​MultipleSecondaryEventSourceIT.java Waits for ConfigMap creation before taking the execution baseline and updating resources.

Review effort: Balanced

@csviri
csviri merged commit cbc35fb into operator-framework:main Dec 3, 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