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)