Skip to content

Commit

Permalink
Add HTTP server startup timeouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Apr 6, 2024
1 parent 3ee9f23 commit dade609
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;

@Timeout(value = 5_000L, unit = TimeUnit.SECONDS)
public final class EHTTP0Test
{
private static final Logger LOG =
LoggerFactory.getLogger(EHTTP0Test.class);

private static final Duration STARTUP_TIMEOUT =
Duration.ofSeconds(5L);

private static final int PORT = 47000;
private static EHTTP0Server SERVER;
private static InetSocketAddress ADDRESS;
Expand All @@ -70,7 +74,9 @@ public static void setupOnce()
SERVER =
new EHTTP0Server(ADDRESS);

SERVER.start();
assertTimeoutPreemptively(STARTUP_TIMEOUT, () -> {
SERVER.start();
});
}

@AfterAll
Expand Down

0 comments on commit dade609

Please sign in to comment.