From f29e4f7af9daeed3e8b3ebd5287c62ed9b195e77 Mon Sep 17 00:00:00 2001 From: Lucas Burson Date: Sat, 28 Oct 2023 15:36:53 -0500 Subject: [PATCH] Fix ProjectAPIIntegrationTests and add it to CI Fixed the connection issue in the project integration tests by supporing the 'scheme'. Added cleanup steps to remove lingering projects after successful tests in ProjectAPIIntegrationTest. Also edited `quality.gradle` to print out the tests that are running. --- .github/workflows/pull-request.yml | 3 ++- gradle/quality.gradle | 11 +++++++++++ .../java/org/maproulette/client/IntegrationBase.java | 3 ++- .../client/api/ProjectAPIIntegrationTest.java | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5d3e1e3..7d9ef15 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -79,7 +79,8 @@ jobs: ./gradlew --info --project-prop runIntegrationTests \ integrationTest \ --tests '*BatchUploaderIntegrationTest*' \ - --tests '*ChallengeAPIIntegrationTest*' + --tests '*ChallengeAPIIntegrationTest*' \ + --tests '*ProjectAPIIntegrationTest*' validation: name: "Gradle Validation" diff --git a/gradle/quality.gradle b/gradle/quality.gradle index 52e1c76..3e68901 100644 --- a/gradle/quality.gradle +++ b/gradle/quality.gradle @@ -51,6 +51,17 @@ task integrationTest(type: Test) { events "passed", "skipped", "failed" exceptionFormat = 'full' } + beforeTest { descriptor -> + logger.lifecycle("Running integration test: " + descriptor) + } + afterSuite { desc, result -> + if (!desc.parent) { // will match the outermost suite + def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)" + def startItem = '| ', endItem = ' |' + def repeatLength = startItem.length() + output.length() + endItem.length() + println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength)) + } + } } check.dependsOn integrationTest diff --git a/src/integrationTest/java/org/maproulette/client/IntegrationBase.java b/src/integrationTest/java/org/maproulette/client/IntegrationBase.java index 2f68ea7..8916673 100644 --- a/src/integrationTest/java/org/maproulette/client/IntegrationBase.java +++ b/src/integrationTest/java/org/maproulette/client/IntegrationBase.java @@ -88,7 +88,8 @@ public MapRouletteConfiguration getConfigurationExcludingProject() if (this.configuration == null) { this.configurationParamsSetUp(); - this.configuration = new MapRouletteConfiguration(this.host, this.port, this.apiKey); + this.configuration = new MapRouletteConfiguration(this.scheme, this.host, this.port, + this.apiKey); } return this.configuration; } diff --git a/src/integrationTest/java/org/maproulette/client/api/ProjectAPIIntegrationTest.java b/src/integrationTest/java/org/maproulette/client/api/ProjectAPIIntegrationTest.java index c315191..268f544 100644 --- a/src/integrationTest/java/org/maproulette/client/api/ProjectAPIIntegrationTest.java +++ b/src/integrationTest/java/org/maproulette/client/api/ProjectAPIIntegrationTest.java @@ -26,6 +26,7 @@ public void basicAPINewConfigurationTest() throws MapRouletteException final var projectIdentifier = this.getProjectAPIForNewConfiguration().create(project) .getId(); Assertions.assertNotEquals(-1, projectIdentifier); + Assertions.assertTrue(this.getProjectAPI().forceDelete(projectIdentifier)); } @Test @@ -111,6 +112,7 @@ public void childrenTest() throws MapRouletteException Assertions.assertEquals(numberOfChildren, challenges.size()); challenges.forEach( challenge -> Assertions.assertTrue(challengeList.contains(challenge.getId()))); + Assertions.assertTrue(this.getProjectAPI().forceDelete(parentIdentifier)); } private void compare(final Project project1, final Project project2)