This is an automated email from the ASF dual-hosted git repository.
pnowojski pushed a commit to branch release-1.17
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.17 by this push:
new ca62b0070cf [FLINK-27756] Refactor Async Sink send gauge test
ca62b0070cf is described below
commit ca62b0070cf30c3154b180b8ffddcc422c066cc7
Author: Ahmed Hamdy <[email protected]>
AuthorDate: Mon Jan 1 15:41:27 2024 +0000
[FLINK-27756] Refactor Async Sink send gauge test
---
.../base/sink/writer/AsyncSinkWriterTest.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git
a/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriterTest.java
b/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriterTest.java
index ac4d9447e15..774d2436143 100644
---
a/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriterTest.java
+++
b/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriterTest.java
@@ -112,16 +112,20 @@ public class AsyncSinkWriterTest {
AsyncSinkWriterImpl sink =
new AsyncSinkWriterImplBuilder()
.context(sinkInitContext)
- .maxBatchSize(4)
- .delay(100)
+ .maxBatchSize(2)
+ .delay(50)
.build();
- for (int i = 0; i < 4; i++) {
- sink.write(String.valueOf(i));
- }
+ sink.write(String.valueOf(1));
+ // introduce artificial delay, shouldn't be calculated in send time
+ Thread.sleep(50);
+ long sendStartTimestamp = System.currentTimeMillis();
sink.flush(true);
+ long sendCompleteTimestamp = System.currentTimeMillis();
+
+ assertThat(sinkInitContext.getCurrentSendTimeGauge().get().getValue())
+ .isGreaterThanOrEqualTo(50);
assertThat(sinkInitContext.getCurrentSendTimeGauge().get().getValue())
- .isGreaterThanOrEqualTo(99);
-
assertThat(sinkInitContext.getCurrentSendTimeGauge().get().getValue()).isLessThan(120);
+ .isLessThanOrEqualTo(sendCompleteTimestamp -
sendStartTimestamp);
}
@Test