From 3be3808fae66f8f01a47d6ca544f5d2b33acb571 Mon Sep 17 00:00:00 2001 From: Jacobjob Koster Date: Mon, 19 Aug 2024 11:07:35 +0200 Subject: [PATCH] STNG-131 Re-enable tests of sandboxIds. Remove Carrier1Prompt and Platform1Prompt tests. Disable confusing API tests, which throw useless timeouts. --- .../springboot/ConformanceApplication.java | 6 ++-- .../ConformanceApplicationTest.java | 8 ++--- .../springboot/ConformanceBasicAPITest.java | 34 ++----------------- .../src/test/resources/application.properties | 1 + 4 files changed, 8 insertions(+), 41 deletions(-) diff --git a/spring-boot/src/main/java/org/dcsa/conformance/springboot/ConformanceApplication.java b/spring-boot/src/main/java/org/dcsa/conformance/springboot/ConformanceApplication.java index 792ba7ec..e6c97f1a 100644 --- a/spring-boot/src/main/java/org/dcsa/conformance/springboot/ConformanceApplication.java +++ b/spring-boot/src/main/java/org/dcsa/conformance/springboot/ConformanceApplication.java @@ -202,9 +202,7 @@ public ConformanceApplication(ConformanceConfiguration conformanceConfiguration) private void _addSimulatedLambdaDelay() { if (conformanceConfiguration.simulatedLambdaDelay > 0) { - log.info( - "Simulating lambda delay of %d milliseconds" - .formatted(conformanceConfiguration.simulatedLambdaDelay)); + log.info("Simulating lambda delay of {} milliseconds", conformanceConfiguration.simulatedLambdaDelay); try { Thread.sleep(conformanceConfiguration.simulatedLambdaDelay); } catch (InterruptedException e) { @@ -212,7 +210,7 @@ private void _addSimulatedLambdaDelay() { } log.info("Done simulating lambda delay"); } else { - log.info("No simulated lambda delay"); + log.debug("No simulated lambda delay"); } } diff --git a/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceApplicationTest.java b/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceApplicationTest.java index 0a9534d3..e42e2c80 100644 --- a/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceApplicationTest.java +++ b/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceApplicationTest.java @@ -31,7 +31,7 @@ class ConformanceApplicationTest { "booking-200-reference-implementation-auto-all-in-one", "ebl-300-conformance-si-only-auto-all-in-one", "ebl-300-conformance-td-only-auto-all-in-one", -// "ebl-300-reference-implementation-auto-all-in-one", // Perhaps needs fix: STNG-128 +// "ebl-300-reference-implementation-auto-all-in-one", // Works, but takes a long time to run. "eblissuance-300-conformance-auto-all-in-one", "eblsurrender-300-conformance-auto-all-in-one", "jit-120-conformance-auto-all-in-one", @@ -40,10 +40,6 @@ class ConformanceApplicationTest { "tnt-220-conformance-auto-all-in-one" }) void testEachSuite(final String sandboxId) throws InterruptedException { - if (System.currentTimeMillis() > 0) { - log.warn("All tests are DISABLED until framework issue STNG-131 is fixed"); - return; - } log.info("Starting scenario suite: {}", sandboxId); // validate if scenario is listed String rootURL = restTemplate.getForObject("http://localhost:" + port + "/", String.class); @@ -84,7 +80,7 @@ private void checkUntilScenariosAreReady(String sandboxId) throws InterruptedExc Thread.sleep(7_000L); } } while (!status.equals("{\"scenariosLeft\":0}")); - assertEquals("{\"scenariosLeft\":0}", status, "Scenario did not finish. Original start status: " + startStatus); + assertEquals("{\"scenariosLeft\":0}", status, "Scenario '" + sandboxId + "' did not finish properly! Original start status: " + startStatus); log.info("Original start status of sandboxId: {} was: {}", sandboxId, startStatus); } diff --git a/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceBasicAPITest.java b/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceBasicAPITest.java index 68b25b57..f315b1a3 100644 --- a/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceBasicAPITest.java +++ b/spring-boot/src/test/java/org/dcsa/conformance/springboot/ConformanceBasicAPITest.java @@ -1,5 +1,6 @@ package org.dcsa.conformance.springboot; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -38,15 +39,7 @@ void shouldReturnDefaultHomepage() throws Exception { } @Test - void shouldStartBookingScenario() throws Exception { - String sandboxId = "booking-200-conformance-auto-all-in-one"; - mockMvc.perform(get(getAppURL(sandboxId, "reset"))) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().string(containsString("{}"))); - } - - @Test + @Disabled // Still works, but avoid confusing timeouts in CI void shouldReturnStatus() throws Exception { String sandboxId = "booking-200-conformance-auto-all-in-one"; mockMvc.perform(get(getAppURL(sandboxId, "reset"))).andExpect(status().isOk()); @@ -58,6 +51,7 @@ void shouldReturnStatus() throws Exception { } @Test + @Disabled // Still works, but avoid confusing timeouts in CI void shouldReturnReport() throws Exception { String sandboxId = "booking-200-conformance-auto-all-in-one"; mockMvc.perform(get(getAppURL(sandboxId, "reset"))).andExpect(status().isOk()); @@ -88,28 +82,6 @@ void shouldReturnPrintableReport() throws Exception { .andExpect(content().string(containsString("SupplyCSP [REGULAR]"))); } - @Test - void shouldReturnCarrier1Prompt() throws Exception { - String sandboxId = "booking-200-conformance-auto-all-in-one"; - mockMvc.perform(get(getAppURL(sandboxId, "reset"))).andExpect(status().isOk()); - - mockMvc.perform(get(getAppURL(sandboxId, "party/Carrier1/prompt/json"))) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().string(containsString("SupplyCSP [REGULAR]"))); - } - - @Test - void shouldReturnPlatform1Prompt() throws Exception { - String sandboxId = "booking-200-conformance-auto-all-in-one"; - mockMvc.perform(get(getAppURL(sandboxId, "reset"))).andExpect(status().isOk()); - - mockMvc.perform(get(getAppURL(sandboxId, "party/Platform1/prompt/json"))) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().string(containsString("[ ]"))); - } - private String getAppURL(String scenarioID, String urlPath) { return "/conformance/" + app.localhostAuthUrlToken + "/sandbox/" + scenarioID + "/" + urlPath; } diff --git a/spring-boot/src/test/resources/application.properties b/spring-boot/src/test/resources/application.properties index 3603bcec..d523b4a1 100644 --- a/spring-boot/src/test/resources/application.properties +++ b/spring-boot/src/test/resources/application.properties @@ -10,3 +10,4 @@ conformance.createAutoTestingSandboxes = true conformance.createManualTestingSandboxes = false conformance.useDynamoDb = false conformance.showOnlyAllInOneSandboxes=true +#conformance.simulatedLambdaDelay=2000