Skip to content

Commit cee2934

Browse files
csviriclaude
andauthored
fix(test): avoid NPE on missing status in WorkflowAllFeatureIT (#3736)
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. Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 07e1af3 commit cee2934

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ void configMapNotReconciledUntilDeploymentReady() {
6565
.isPositive();
6666
assertThat(operator.get(Deployment.class, RESOURCE_NAME)).isNotNull();
6767
assertThat(operator.get(ConfigMap.class, RESOURCE_NAME)).isNull();
68-
assertThat(getPrimaryStatus().getMsgFromCondition())
68+
var status = getPrimaryStatus();
69+
assertThat(status).isNotNull();
70+
assertThat(status.getMsgFromCondition())
6971
.isEqualTo(ConfigMapReconcileCondition.NOT_RECONCILED_YET);
7072
});
7173

@@ -80,6 +82,7 @@ void configMapNotReconciledUntilDeploymentReady() {
8082
.isGreaterThan(1);
8183
assertThat(operator.get(ConfigMap.class, RESOURCE_NAME)).isNotNull();
8284
final var primaryStatus = getPrimaryStatus();
85+
assertThat(primaryStatus).isNotNull();
8386
assertThat(primaryStatus.getReady()).isTrue();
8487
assertThat(primaryStatus.getMsgFromCondition())
8588
.isEqualTo(ConfigMapReconcileCondition.CREATE_SET);

0 commit comments

Comments
 (0)