Skip to content

Commit 7a70a96

Browse files
authored
Fix ProjectAPIIntegrationTests and add it to CI (#135)
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.
1 parent b606a37 commit 7a70a96

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

.github/workflows/pull-request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ jobs:
7979
./gradlew --info --project-prop runIntegrationTests \
8080
integrationTest \
8181
--tests '*BatchUploaderIntegrationTest*' \
82-
--tests '*ChallengeAPIIntegrationTest*'
82+
--tests '*ChallengeAPIIntegrationTest*' \
83+
--tests '*ProjectAPIIntegrationTest*'
8384
8485
validation:
8586
name: "Gradle Validation"

gradle/quality.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ task integrationTest(type: Test) {
5151
events "passed", "skipped", "failed"
5252
exceptionFormat = 'full'
5353
}
54+
beforeTest { descriptor ->
55+
logger.lifecycle("Running integration test: " + descriptor)
56+
}
57+
afterSuite { desc, result ->
58+
if (!desc.parent) { // will match the outermost suite
59+
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
60+
def startItem = '| ', endItem = ' |'
61+
def repeatLength = startItem.length() + output.length() + endItem.length()
62+
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
63+
}
64+
}
5465
}
5566

5667
check.dependsOn integrationTest

src/integrationTest/java/org/maproulette/client/IntegrationBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public MapRouletteConfiguration getConfigurationExcludingProject()
8888
if (this.configuration == null)
8989
{
9090
this.configurationParamsSetUp();
91-
this.configuration = new MapRouletteConfiguration(this.host, this.port, this.apiKey);
91+
this.configuration = new MapRouletteConfiguration(this.scheme, this.host, this.port,
92+
this.apiKey);
9293
}
9394
return this.configuration;
9495
}

src/integrationTest/java/org/maproulette/client/api/ProjectAPIIntegrationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public void basicAPINewConfigurationTest() throws MapRouletteException
2626
final var projectIdentifier = this.getProjectAPIForNewConfiguration().create(project)
2727
.getId();
2828
Assertions.assertNotEquals(-1, projectIdentifier);
29+
Assertions.assertTrue(this.getProjectAPI().forceDelete(projectIdentifier));
2930
}
3031

3132
@Test
@@ -111,6 +112,7 @@ public void childrenTest() throws MapRouletteException
111112
Assertions.assertEquals(numberOfChildren, challenges.size());
112113
challenges.forEach(
113114
challenge -> Assertions.assertTrue(challengeList.contains(challenge.getId())));
115+
Assertions.assertTrue(this.getProjectAPI().forceDelete(parentIdentifier));
114116
}
115117

116118
private void compare(final Project project1, final Project project2)

0 commit comments

Comments
 (0)