Follow up for issue #10933 and associated PR #10949.

Fixed HttpChannelTest.testOnFailure().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2023-12-17 13:52:09 +01:00
parent 62210d39c2
commit e481b45cda
No known key found for this signature in database
GPG Key ID: 1677D141BCF3584D
1 changed files with 5 additions and 6 deletions

View File

@ -1220,17 +1220,16 @@ public class HttpChannelTest
assertThat(chunk.getFailure(), sameInstance(failure));
CountDownLatch demand = new CountDownLatch(1);
// Demand callback not serialized until after onFailure listeners.
// Demand callback is serialized after the onFailure task runs.
rq.demand(demand::countDown);
assertThat(demand.getCount(), is(0L));
assertThat(demand.getCount(), is(1L));
FuturePromise<Throwable> callback = new FuturePromise<>();
// Write callback not serialized until after onFailure listeners.
handling.get().write(false, null, Callback.from(() ->
{}, callback::succeeded));
// Write callback not serialized until after the onFailure task runs.
handling.get().write(false, null, Callback.from(() -> {}, callback::succeeded));
assertTrue(callback.isDone());
// Process onFailure task.
// Run the onFailure task.
try (StacklessLogging ignore = new StacklessLogging(Response.class))
{
onFailure.run();