gyfora commented on code in PR #657:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/657#discussion_r1310284098
##########
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java:
##########
@@ -847,6 +865,62 @@ public void cancelJob(
assertEquals(1, rescaleCounter.get());
}
+ @Test
+ public void testScaleWithJobGraphKeptInHAMetadata() throws Exception {
+ final String jobGraphKey = Constants.JOB_GRAPH_STORE_KEY_PREFIX +
JobID.generate();
+ final String jobGraphVal = "job-graph-data";
+ createHAConfigMapWithData(
+ kubernetesClient,
+ "ha-configmap",
+ TEST_NAMESPACE,
+ TEST_DEPLOYMENT_NAME,
+ Collections.singletonMap(jobGraphKey, jobGraphVal));
+ final Map<String, String> configMapLabels =
+ KubernetesUtils.getConfigMapLabels(
+ TEST_DEPLOYMENT_NAME,
Constants.LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY);
+ assertEquals(
+ jobGraphVal,
+ kubernetesClient
+ .configMaps()
+ .inNamespace(TEST_NAMESPACE)
+ .withLabels(configMapLabels)
+ .list()
+ .getItems()
+ .get(0)
+ .getData()
+ .get(jobGraphKey));
+
+ FlinkDeployment deployment = TestUtils.buildApplicationCluster();
+ getJobSpec(deployment).setUpgradeMode(UpgradeMode.LAST_STATE);
+ deployment
+ .getSpec()
+ .getFlinkConfiguration()
+ .put(
+ KubernetesOperatorConfigOptions
+
.OPERATOR_JOB_UPGRADE_LAST_STATE_FALLBACK_ENABLED
+ .key(),
+ "false");
+ reconciler.reconcile(deployment, context);
+
deployment.getStatus().setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
+ flinkService.clear();
+ deployment
+ .getSpec()
+ .getFlinkConfiguration()
+ .put(PipelineOptions.PARALLELISM_OVERRIDES.key(), new
JobVertexID() + ":1");
+ reconciler.reconcile(deployment, context);
+ assertEquals(
+ jobGraphVal,
+ kubernetesClient
+ .configMaps()
+ .inNamespace(TEST_NAMESPACE)
+ .withLabels(configMapLabels)
+ .list()
+ .getItems()
+ .get(0)
+ .getData()
+ .get(jobGraphKey));
Review Comment:
I think this test is incorrect in the sense that it doesn't validate the
right things.
The last-state-fallback config is unnecessary.
After the first reconcile you can use:
```
reconciler.reconcile(deployment, context);
verifyAndSetRunningJobsToStatus(deployment, flinkService.listJobs());
```
Like in other tests. After that you should submit the scale change, verify
that after first reconcile the job is suspended, and after the second reconcile
(during deployment) the job graph is not deleted
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]