RocMarshal commented on code in PR #824:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/824#discussion_r1594866016
##########
flink-autoscaler-standalone/src/test/java/org/apache/flink/autoscaler/standalone/StandaloneAutoscalerExecutorTest.java:
##########
@@ -227,6 +229,160 @@ public void cleanup(JobID jobID) {
}
}
+ @Test
+ void testCleanupAfterStopped() throws Exception {
+ var eventCollector = new TestingEventCollector<JobID,
JobAutoScalerContext<JobID>>();
+
+ var job1 = createJobAutoScalerContext();
+ var job2 = createJobAutoScalerContext();
+ var scaleCounter = new ConcurrentHashMap<JobID, Integer>();
+ var cleanupCounter = new ConcurrentHashMap<JobID, Integer>();
+
+ var jobList = new ArrayList<JobAutoScalerContext<JobID>>();
+
+ try (var autoscalerExecutor =
+ new StandaloneAutoscalerExecutor<>(
+ new Configuration(),
+ () -> jobList,
+ eventCollector,
+ new JobAutoScaler<>() {
+ @Override
+ public void scale(JobAutoScalerContext<JobID>
context) {
+ scaleCounter.put(
+ context.getJobKey(),
+
scaleCounter.getOrDefault(context.getJobKey(), 0) + 1);
+ }
+
+ @Override
+ public void cleanup(JobID jobID) {
+ cleanupCounter.put(
+ jobID,
cleanupCounter.getOrDefault(jobID, 0) + 1);
+ }
+ })) {
+
+ // Test for empty job list.
+ autoscalerExecutor.scaling();
+ Thread.sleep(100);
Review Comment:
Could we use the CompletableFuture to overwrite some lines like this one?
I made a rough draft.
[draft-patch.txt](https://github.com/apache/flink-kubernetes-operator/files/15256511/draft-patch.txt)
But I have to admit that the draft still is a bit of redundant. Because the
draft use the `completableFuture` by introducing an useless `return value` of
some methods.
--
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]