Skip to content

Commit d25b9df

Browse files
vsantwanaclaude
andcommitted
Add test proving backoffLimit=-1 (unlimited retries) bug in FlinkStateSnapshot
The default backoffLimit of -1 (documented as "unlimited retries") causes snapshots to immediately fail after the first error. The check `failures > backoffLimit` evaluates to `1 > -1` which is always true, so no retries ever happen with the default configuration. This test is expected to fail until the bug is fixed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2d4c992 commit d25b9df

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotControllerTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,25 @@ public void testReconcileBackoff(int backoffLimit) {
150150
assertThat(snapshot.getStatus().getState()).isEqualTo(FAILED);
151151
}
152152

153+
@Test
154+
public void testReconcileBackoffUnlimited() {
155+
var deployment = createDeployment();
156+
context = TestUtils.createSnapshotContext(client, deployment);
157+
// Default backoffLimit is -1, meaning unlimited retries
158+
var snapshot = createSavepoint(deployment, false, -1);
159+
snapshot.setStatus(new FlinkStateSnapshotStatus());
160+
161+
flinkService.setTriggerSavepointFailure(true);
162+
163+
// With unlimited retries, the snapshot should never transition to FAILED
164+
for (int i = 0; i < 10; i++) {
165+
controller.updateErrorStatus(snapshot, context, new Exception());
166+
assertThat(snapshot.getStatus().getState())
167+
.as("Snapshot with backoffLimit=-1 should retry indefinitely, but failed after attempt %d", i + 1)
168+
.isEqualTo(TRIGGER_PENDING);
169+
}
170+
}
171+
153172
@ParameterizedTest
154173
@ValueSource(booleans = {true, false})
155174
public void testReconcileSavepointAlreadyExists(boolean jobReferenced) {

0 commit comments

Comments
 (0)