diff --git a/.github/workflows/ci-pull.yml b/.github/workflows/ci-pull.yml index fd51124..e2dfaec 100644 --- a/.github/workflows/ci-pull.yml +++ b/.github/workflows/ci-pull.yml @@ -40,23 +40,22 @@ jobs: java-version: 21 distribution: 'temurin' cache: maven - - name: Compile App - run: mvn -B compiler:compile - - name: Compile Tests - run: mvn -B compiler:testCompile - - name: Create Server - run: mvn -B liberty:create - - name: Deploy App - run: mvn -B liberty:deploy + - name: Compile App and Tests + - run: mvn -B compiler:compile + - run: mvn -B compiler:testCompile + - name: Create Server and Deploy App + - run: mvn -B liberty:create + - run: mvn -B liberty:deploy - name: Start Server - run: mvn -B liberty:test-start + run: mvn -B liberty:start - name: Run Integration Tests run: mvn -B failsafe:integration-test - name: Stop Server - run: mvn -B liberty:test-stop + run: mvn -B liberty:stop - name: Verify Integration Test Results run: mvn -B failsafe:verify - name: Archive Liberty logs + if: ${{ failure() }} uses: actions/upload-artifact@v3 with: name: liberty-logs diff --git a/src/test/java/io/openliberty/sample/it/CrewServiceIT.java b/src/test/java/io/openliberty/sample/it/CrewServiceIT.java index fefaadc..37cf7df 100644 --- a/src/test/java/io/openliberty/sample/it/CrewServiceIT.java +++ b/src/test/java/io/openliberty/sample/it/CrewServiceIT.java @@ -42,8 +42,7 @@ public class CrewServiceIT { private Response response; @BeforeAll - public static void init() { - + public static void init() { String port = System.getProperty("http.port"); baseURL = "http://localhost:" + port + "/"; } @@ -56,6 +55,7 @@ public void setup() { @AfterEach public void teardown() { + response.close(); client.close(); } @@ -69,7 +69,7 @@ public void testAddGetDeleteCrewMember() { //Check Add response = client.target(baseURL + "db/crew/it").request().post(Entity.json("{\"name\":\"Mark\",\"rank\":\"Captain\",\"crewID\":\"75\"}")); - assertEquals(200, response.getStatus()); + assertEquals(200, response.getStatus(), "output: " + response.readEntity(String.class)); //Check Get response = client.target(baseURL + "db/crew").request().get(); @@ -84,7 +84,7 @@ public void testAddGetDeleteCrewMember() { //Check Delete response = client.target(baseURL + "db/crew/75").request().delete(); - assertEquals(200, response.getStatus()); + assertEquals(200, response.getStatus(), "output: " + response.readEntity(String.class)); //Confirm Delete response = client.target(baseURL + "db/crew").request().get(); @@ -131,7 +131,6 @@ public void testValidationCrewMember() { private boolean isPostgresAvailable() { return checkHostAndPort("localhost", 5432); - // || checkHostAndPort("otherHost", 5432); } private boolean checkHostAndPort(String host, int port) {