Light, fluffy, and always free - The AWS Local Emulator alternative
fix(lambda): use SO_REUSEADDR in stopReleasesPortSynchronously test (#991)
Hector Venturac0ff98d0a89c
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.javaindex 70d7a3b9b5..6a652980b2 100644--- a/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java@@ -9,6 +9,8 @@ import org.junit.jupiter.api.Test;import org.junit.jupiter.api.Timeout;import java.io.IOException;+import java.net.BindException;+import java.net.InetSocketAddress;import java.net.ServerSocket;import java.net.URI;import java.net.http.HttpClient;@@ -19,9 +21,13 @@ import java.util.concurrent.Executors;import java.util.concurrent.ScheduledExecutorService;import java.util.concurrent.TimeUnit;+import org.junit.jupiter.api.condition.EnabledOnOs;+import org.junit.jupiter.api.condition.OS;+import static org.junit.jupiter.api.Assertions.assertEquals;import static org.junit.jupiter.api.Assertions.assertFalse;import static org.junit.jupiter.api.Assertions.assertNotNull;+import static org.junit.jupiter.api.Assertions.assertThrows;import static org.junit.jupiter.api.Assertions.assertTrue;class RuntimeApiServerTest {@@ -227,7 +233,10 @@ class RuntimeApiServerTest {@Timeout(10)void stopReleasesPortSynchronously() throws Exception {server.stop().get(5, TimeUnit.SECONDS);- new ServerSocket(port).close();+ try (ServerSocket s = new ServerSocket()) {+ s.setReuseAddress(true);+ s.bind(new InetSocketAddress(port));+ }}@Test