Myasuka commented on code in PR #23764:
URL: https://github.com/apache/flink/pull/23764#discussion_r1403244878
##########
flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/resources/KubernetesSharedInformerITCase.java:
##########
@@ -72,56 +71,41 @@ void setUp() throws Exception {
@AfterEach
void tearDown() throws Exception {
ExecutorUtils.gracefulShutdown(5, TimeUnit.SECONDS,
watchCallbackExecutorService);
- client.deleteConfigMapsByLabels(labels).get();
+ client.deleteConfigMap(configMapName).get();
}
@Test
@Timeout(120000)
public void testWatch() throws Exception {
try (KubernetesConfigMapSharedWatcher watcher =
- client.createConfigMapSharedWatcher(labels)) {
+ client.createConfigMapSharedWatcher(configMapName)) {
for (int i = 0; i < 10; i++) {
- List<TestingCallbackHandler> callbackHandlers = new
ArrayList<>();
- List<Watch> watchers = new ArrayList<>();
-
- watchInRange(watcher, callbackHandlers, watchers, 0, 20);
- createConfigMapsInRange(0, 5);
- watchInRange(watcher, callbackHandlers, watchers, 20, 40);
- createConfigMapsInRange(5, 10);
- updateConfigMapInRange(0, 10, ImmutableMap.of("foo", "bar"));
- for (TestingCallbackHandler handler : callbackHandlers) {
- handler.addFuture.get();
- handler.addOrUpdateFuture.get();
-
assertThat(handler.assertFuture).isNotCompletedExceptionally();
+ Tuple2<TestingCallbackHandler, Watch> results =
watch(configMapName, watcher);
+ TestingCallbackHandler handler = results.f0;
+ createConfigMap(configMapName);
+ updateConfigMap(configMapName, ImmutableMap.of("foo", "bar"));
+
+ handler.addFuture.get();
+ handler.addOrUpdateFuture.get();
+ assertThat(handler.assertFuture).isNotCompletedExceptionally();
+
+ client.deleteConfigMap(configMapName).get();
+ handler.deleteFuture.get();
+ if (handler.assertFuture.isCompletedExceptionally()) {
+ handler.assertFuture.get();
Review Comment:
Thanks for the suggestion, I will refactor this test.
--
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]