From c8e294d43b49a88163cbdb9ed29b4732a391327b Mon Sep 17 00:00:00 2001 From: Brian Laub Date: Wed, 13 Nov 2024 16:46:16 -0500 Subject: [PATCH] fix test --- .../palantir/dialogue/core/DialogueChannelTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dialogue-core/src/test/java/com/palantir/dialogue/core/DialogueChannelTest.java b/dialogue-core/src/test/java/com/palantir/dialogue/core/DialogueChannelTest.java index dea2be76c..569fdd5d1 100644 --- a/dialogue-core/src/test/java/com/palantir/dialogue/core/DialogueChannelTest.java +++ b/dialogue-core/src/test/java/com/palantir/dialogue/core/DialogueChannelTest.java @@ -380,6 +380,7 @@ void test_cached_host_channel_state_retained_when_reloaded() throws Exception { .build()) .factory(_args -> mockChannel) .uris(targetUrisRefreshable) + .maxQueueSize(1) .build(); // force a bunch of failed requests to drive down the concurrency limit @@ -394,10 +395,16 @@ void test_cached_host_channel_state_retained_when_reloaded() throws Exception { when(mockChannel.execute(any(), any())).thenReturn(SettableFuture.create()); - // Queue a request + // First request should start executing + ListenableFuture started = channel.execute(endpoint, request); + assertThat(started).isNotDone(); + + // Next request should queue ListenableFuture queued = channel.execute(endpoint, request); assertThat(queued).isNotDone(); - // Next request should be rejected. + + // Next request should be rejected as the queue is full, and concurrency limits have dropped too low, + // even after the channel was reloaded ListenableFuture rejected = channel.execute(endpoint, request); assertThat(rejected).isDone(); assertThatThrownBy(rejected::get)