diff --git a/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DevServerComponent.java b/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DevServerComponent.java index b708341..ad62add 100644 --- a/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DevServerComponent.java +++ b/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DevServerComponent.java @@ -15,10 +15,11 @@ public class DevServerComponent { static String baseUrl = "http://127.0.0.1:8288"; OkHttpClient httpClient = new OkHttpClient(); + Process devServerProcess; + DevServerComponent(CommHandler commHandler) throws Exception { Runtime rt = Runtime.getRuntime(); - rt.exec("pkill inngest-cli"); - rt.exec("npx -y inngest-cli dev -u http://127.0.0.1:8080/api/inngest"); + devServerProcess = rt.exec("npx -y inngest-cli@latest dev -u http://localhost:8080/api/inngest --port 8288 --no-discovery --no-poll --retry-interval 1"); waitForStartup(commHandler); } @@ -32,7 +33,7 @@ private void waitForStartup(CommHandler commHandler) throws Exception { try (Response response = httpClient.newCall(request).execute()) { if (response.code() == 200) { - Thread.sleep(3000); + Thread.sleep(6000); commHandler.register("http://localhost:8080", null); return; } @@ -102,8 +103,9 @@ private T makeRequest(Request request, TypeReference typeReference) throw @PreDestroy - public void stop() throws Exception { - Runtime rt = Runtime.getRuntime(); - rt.exec("pkill inngest-cli"); + public void stop() { + if (devServerProcess != null && devServerProcess.isAlive()) { + devServerProcess.destroy(); + } } } diff --git a/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DevModeIntrospectionTest.java b/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DevModeIntrospectionTest.java index 628c577..dd64d6c 100644 --- a/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DevModeIntrospectionTest.java +++ b/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DevModeIntrospectionTest.java @@ -4,6 +4,8 @@ import com.inngest.Version; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfSystemProperty; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ExecutionMode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.context.annotation.Import; @@ -12,15 +14,13 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; -@Import(DemoTestConfiguration.class) -@WebMvcTest(DemoController.class) +@IntegrationTest +@Execution(ExecutionMode.CONCURRENT) public class DevModeIntrospectionTest { - @Autowired private MockMvc mockMvc; @Test - @EnabledIfSystemProperty(named = "test-group", matches = "unit-test") public void shouldReturnInsecureIntrospectPayload() throws Exception { mockMvc.perform(get("/api/inngest").header("Host", "localhost:8080")) .andExpect(status().isOk())