Skip to content

Commit cbc35fb

Browse files
csviriclaude
andauthored
fix(test): wait for ConfigMaps before updating them in MultipleSecondaryEventSourceIT (#3739)
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. Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2654109 commit cbc35fb

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/multiplesecondaryeventsource/MultipleSecondaryEventSourceIT.java‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import io.javaoperatorsdk.annotation.Sample;
2626
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
2727

28+
import static org.assertj.core.api.Assertions.assertThat;
2829
import static org.awaitility.Awaitility.await;
2930

3031
@Sample(
@@ -54,6 +55,21 @@ void receivingPeriodicEvents() {
5455

5556
var reconciler = operator.getReconcilerOfType(MultipleSecondaryEventSourceReconciler.class);
5657

58+
await()
59+
.untilAsserted(
60+
() -> {
61+
assertThat(
62+
operator.get(
63+
ConfigMap.class,
64+
MultipleSecondaryEventSourceReconciler.getName1(resource)))
65+
.isNotNull();
66+
assertThat(
67+
operator.get(
68+
ConfigMap.class,
69+
MultipleSecondaryEventSourceReconciler.getName2(resource)))
70+
.isNotNull();
71+
});
72+
5773
await().pollDelay(Duration.ofMillis(300)).until(() -> reconciler.getNumberOfExecutions() <= 3);
5874

5975
int numberOfInitialExecutions = reconciler.getNumberOfExecutions();

0 commit comments

Comments
 (0)