Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ protected void observeJmDeployment(FlinkResourceContext<FlinkDeployment> ctx) {
}

deploymentStatus.setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
deploymentStatus.getJobStatus().setState(JobStatus.RECONCILING);

if (!ReconciliationUtils.isJobInTerminalState(deploymentStatus)) {
deploymentStatus.getJobStatus().setState(JobStatus.RECONCILING);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a unit test to guard this change against accidental future regressions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All done. Happy to make any other changes.

}

if (previousJmStatus != JobManagerDeploymentStatus.MISSING
&& previousJmStatus != JobManagerDeploymentStatus.ERROR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,4 +876,26 @@ public void validateLastReconciledClearedOnInitialFailure() {
observer.observe(deployment, TestUtils.createEmptyContext());
assertTrue(reconStatus.isBeforeFirstDeployment());
}

@Test
public void jobStatusNotOverwrittenWhenTerminal() throws Exception {
Configuration conf =
configManager.getDeployConfig(deployment.getMetadata(), deployment.getSpec());
flinkService.submitApplicationCluster(deployment.getSpec().getJob(), conf, false);
bringToReadyStatus(deployment);

deployment
.getStatus()
.getJobStatus()
.setState(org.apache.flink.api.common.JobStatus.FINISHED);

// Simulate missing deployment
var emptyContext = TestUtils.createEmptyContext();
deployment.getStatus().setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
observer.observe(deployment, emptyContext);

assertEquals(
org.apache.flink.api.common.JobStatus.FINISHED,
deployment.getStatus().getJobStatus().getState());
}
}