mananmangal commented on code in PR #648: URL: https://github.com/apache/flink-kubernetes-operator/pull/648#discussion_r1291624743
########## flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java: ########## @@ -1070,4 +1070,33 @@ public void testUpgradeReconciledGeneration() throws Exception { .getMetadata() .getGeneration()); } + + @ParameterizedTest + @MethodSource("org.apache.flink.kubernetes.operator.TestUtils#flinkVersions") + public void testSubmitAndDrainOnCleanUpWithSavepoint(FlinkVersion flinkVersion) + throws Exception { + var conf = configManager.getDefaultConfig(); + conf.set(KubernetesOperatorConfigOptions.SAVEPOINT_ON_DELETION, true); + conf.set(KubernetesOperatorConfigOptions.DRAIN_ON_SAVEPOINT_DELETION, true); + configManager.updateDefaultConfig(conf); + + FlinkDeployment deployment = TestUtils.buildApplicationCluster(flinkVersion); + + // session ready + reconciler.reconcile(deployment, TestUtils.createContextWithReadyFlinkDeployment()); + verifyAndSetRunningJobsToStatus(deployment, flinkService.listJobs()); + + // clean up + assertEquals( + null, deployment.getStatus().getJobStatus().getSavepointInfo().getLastSavepoint()); + reconciler.cleanup(deployment, TestUtils.createContextWithReadyFlinkDeployment()); + assertEquals( + "savepoint_0", + deployment + .getStatus() + .getJobStatus() + .getSavepointInfo() + .getLastSavepoint() + .getLocation()); + } Review Comment: I understand, I will make these changes. ########## flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java: ########## @@ -1070,4 +1070,33 @@ public void testUpgradeReconciledGeneration() throws Exception { .getMetadata() .getGeneration()); } + + @ParameterizedTest + @MethodSource("org.apache.flink.kubernetes.operator.TestUtils#flinkVersions") + public void testSubmitAndDrainOnCleanUpWithSavepoint(FlinkVersion flinkVersion) + throws Exception { + var conf = configManager.getDefaultConfig(); + conf.set(KubernetesOperatorConfigOptions.SAVEPOINT_ON_DELETION, true); + conf.set(KubernetesOperatorConfigOptions.DRAIN_ON_SAVEPOINT_DELETION, true); + configManager.updateDefaultConfig(conf); + + FlinkDeployment deployment = TestUtils.buildApplicationCluster(flinkVersion); + + // session ready + reconciler.reconcile(deployment, TestUtils.createContextWithReadyFlinkDeployment()); + verifyAndSetRunningJobsToStatus(deployment, flinkService.listJobs()); + + // clean up + assertEquals( + null, deployment.getStatus().getJobStatus().getSavepointInfo().getLastSavepoint()); + reconciler.cleanup(deployment, TestUtils.createContextWithReadyFlinkDeployment()); + assertEquals( + "savepoint_0", + deployment + .getStatus() + .getJobStatus() + .getSavepointInfo() + .getLastSavepoint() + .getLocation()); + } Review Comment: Replaced unit tests to AbstractFlinkServiceTests -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org