Skip to content

Commit 82b8555

Browse files
committed
Use static batching in test to have a number for confirm latency
Confirm latency can be 0 with dynamic batching, because messages are sent right away.
1 parent eac4c92 commit 82b8555

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/test/java/com/rabbitmq/stream/perf/StreamPerfTestTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ static void tearDown() {
8989
}
9090

9191
static void waitOneSecond() throws InterruptedException {
92-
Thread.sleep(1000L);
92+
wait(Duration.ofSeconds(1));
93+
}
94+
95+
static void wait(Duration duration) throws InterruptedException {
96+
Thread.sleep(duration.toMillis());
9397
}
9498

9599
private static HttpResponse httpRequest(String urlString) throws Exception {
@@ -427,7 +431,7 @@ void metricsTagsShouldShowUpInHttpEndpoint() throws Exception {
427431

428432
@Test
429433
void publishConfirmLatencyShouldBeIncludedWhenOptionIsEnabled() throws Exception {
430-
Future<?> run = run(builder().confirmLatency());
434+
Future<?> run = run(builder().confirmLatency().dynamicBatch(false));
431435
waitUntilStreamExists(s);
432436
waitOneSecond();
433437
run.cancel(true);
@@ -619,6 +623,11 @@ ArgumentsBuilder confirmLatency() {
619623
return this;
620624
}
621625

626+
ArgumentsBuilder dynamicBatch(boolean dynamicBatch) {
627+
arguments.put("dynamic-batch-size", String.valueOf(dynamicBatch));
628+
return this;
629+
}
630+
622631
ArgumentsBuilder maxLengthBytes(ByteCapacity capacity) {
623632
arguments.put("max-length-bytes", capacity.toString());
624633
return this;

0 commit comments

Comments
 (0)