Skip to content

Commit

Permalink
Fix ProjectAPIIntegrationTests and add it to CI (#135)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ljdelight authored Oct 28, 2023
1 parent b606a37 commit 7a70a96
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ jobs:
./gradlew --info --project-prop runIntegrationTests \
integrationTest \
--tests '*BatchUploaderIntegrationTest*' \
--tests '*ChallengeAPIIntegrationTest*'
--tests '*ChallengeAPIIntegrationTest*' \
--tests '*ProjectAPIIntegrationTest*'
validation:
name: "Gradle Validation"
Expand Down
11 changes: 11 additions & 0 deletions gradle/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7a70a96

Please sign in to comment.