Copilot commented on code in PR #4322:
URL: https://github.com/apache/flink-cdc/pull/4322#discussion_r2958315889


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/test/java/org/apache/flink/cdc/connectors/mongodb/table/MongoDBConnectorITCase.java:
##########
@@ -193,23 +208,24 @@ void testConsumingAllEvents(boolean parallelismSnapshot)
         // 0.5 |
         // 
+-----+--------------------+---------------------------------------------------------+--------+
 
-        String[] expected =
-                new String[] {
-                    "scooter,3.140",
-                    "car battery,8.100",
-                    "12-pack drill bits,0.800",
-                    "hammer,2.625",
-                    "rocks,5.100",
-                    "jacket,0.600",
-                    "spare tire,22.200"
-                };
-
         List<String> actual = 
TestValuesTableFactory.getResultsAsStrings("sink");
         Assertions.assertThat(actual).containsExactlyInAnyOrder(expected);
 
         result.getJobClient().get().cancel().get();
     }
 
+    protected void waitForSinkResult(String sinkName, List<String> expected)
+            throws InterruptedException {
+        List<String> sortedExpected = 
expected.stream().sorted().collect(Collectors.toList());
+        List<String> actual = 
TestValuesTableFactory.getResultsAsStrings(sinkName);
+        List<String> sortedActual = 
actual.stream().sorted().collect(Collectors.toList());
+        while (!sortedActual.equals(sortedExpected)) {
+            sleep(1000);
+            actual = TestValuesTableFactory.getResultsAsStrings(sinkName);
+            sortedActual = 
actual.stream().sorted().collect(Collectors.toList());
+        }
+    }

Review Comment:
   `waitForSinkResult` loops until the sink matches expected results but has no 
timeout or failure diagnostics. If the job fails or results never converge, 
this test can hang indefinitely and stall CI. Prefer using 
`MongoDBTestUtils.waitForSinkResult(..., Duration)` (which already has a 
timeout + raw results in the failure message) or add an explicit 
timeout/Assertion failure to this loop, and remove the redundant static 
import/local method name clash.



-- 
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]

Reply via email to