Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Laub committed Nov 13, 2024
1 parent 52036fe commit c8e294d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Response> started = channel.execute(endpoint, request);
assertThat(started).isNotDone();

// Next request should queue
ListenableFuture<Response> 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<Response> rejected = channel.execute(endpoint, request);
assertThat(rejected).isDone();
assertThatThrownBy(rejected::get)
Expand Down

0 comments on commit c8e294d

Please sign in to comment.