Skip to content

Commit 72066b7

Browse files
Add unit test
1 parent 0a1dacd commit 72066b7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/observer/deployment/ApplicationObserverTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,4 +876,26 @@ public void validateLastReconciledClearedOnInitialFailure() {
876876
observer.observe(deployment, TestUtils.createEmptyContext());
877877
assertTrue(reconStatus.isBeforeFirstDeployment());
878878
}
879+
880+
@Test
881+
public void jobStatusNotOverwrittenWhenTerminal() throws Exception {
882+
Configuration conf =
883+
configManager.getDeployConfig(deployment.getMetadata(), deployment.getSpec());
884+
flinkService.submitApplicationCluster(deployment.getSpec().getJob(), conf, false);
885+
bringToReadyStatus(deployment);
886+
887+
deployment
888+
.getStatus()
889+
.getJobStatus()
890+
.setState(org.apache.flink.api.common.JobStatus.FINISHED);
891+
892+
// Simulate missing deployment
893+
var emptyContext = TestUtils.createEmptyContext();
894+
deployment.getStatus().setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
895+
observer.observe(deployment, emptyContext);
896+
897+
assertEquals(
898+
org.apache.flink.api.common.JobStatus.FINISHED,
899+
deployment.getStatus().getJobStatus().getState());
900+
}
879901
}

0 commit comments

Comments
 (0)