Skip to content

Commit

Permalink
Fixes #9009 - Flaky test StreamCloseTest.testRequestDataClosedRespons…
Browse files Browse the repository at this point in the history
…eDataClosedClosesStream.

Regression introduced by #8678.
Now using awaitility to wait for the stream count to go to zero.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Dec 6, 2022
1 parent 390abcc commit 7c75768
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jetty.http2.client;

import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
Expand All @@ -38,6 +39,8 @@
import org.eclipse.jetty.util.Promise;
import org.junit.jupiter.api.Test;

import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -179,7 +182,7 @@ public void succeeded()
assertTrue(serverDataLatch.await(5, TimeUnit.SECONDS));
assertTrue(completeLatch.await(5, TimeUnit.SECONDS));
assertTrue(stream.isClosed());
assertEquals(0, stream.getSession().getStreams().size());
await().atMost(Duration.ofSeconds(5)).until(() -> stream.getSession().getStreams().size(), equalTo(0));
}

@Test
Expand Down

0 comments on commit 7c75768

Please sign in to comment.