psolomin commented on code in PR #27484:
URL: https://github.com/apache/beam/pull/27484#discussion_r1269223285


##########
sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/sqs/SqsIOWriteBatchesTest.java:
##########
@@ -187,24 +237,53 @@ public void testWriteBatchesToDynamic() {
   }
 
   @Test
-  public void testWriteBatchesWithTimeout() {
+  public void testWriteBatchesToDynamicWithTimeout() {
     
when(sqs.sendMessageBatch(anyRequest())).thenReturn(completedFuture(SUCCESS));
 
     p.apply(Create.of(5))
         .apply(ParDo.of(new CreateMessages()))
         .apply(
             // simulate delay between messages > batch timeout
-            SqsIO.writeBatches(withDelay(millis(200), SET_MESSAGE_BODY))
-                .withBatchTimeout(millis(100))
-                .to("queue"));
+            SqsIO.writeBatches(withDelay(millis(100), SET_MESSAGE_BODY))
+                .withBatchTimeout(millis(150))
+                .to(msg -> Integer.valueOf(msg) % 2 == 0 ? "even" : "uneven"));
 
     p.run().waitUntilFinish();
 
     SendMessageBatchRequestEntry[] entries = entries(range(0, 5));
-    // due to added delay, batches are timed out on arrival of every 2nd msg
-    verify(sqs).sendMessageBatch(request("queue", entries[0], entries[1]));
-    verify(sqs).sendMessageBatch(request("queue", entries[2], entries[3]));
-    verify(sqs).sendMessageBatch(request("queue", entries[4]));
+    // due to added delay, dynamic batches are timed out on arrival of every 
2nd msg (per batch)
+    verify(sqs).sendMessageBatch(request("even", entries[0], entries[2]));
+    verify(sqs).sendMessageBatch(request("uneven", entries[1], entries[3]));
+    verify(sqs).sendMessageBatch(request("even", entries[4]));
+  }
+
+  @Test
+  public void testWriteBatchesToDynamicWithStrictTimeout() {

Review Comment:
   The test name suggests that it should fail if the strict timeout feature is 
disabled or is not properly working.
   I've tried to break the feature via `this.scheduler = null` in `SqsIO` but 
this tests still passes.
   
   Setting `.withBatchTimeout(millis(10))` does not make the test failing too.
   
   Is it expected?



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