Skip to content

Commit

Permalink
Fix Quarkus-cli flacky test
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo gonzalez granados committed Oct 28, 2021
1 parent 8cc2cf7 commit 819de5e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,22 @@ public void shouldAddAndRemoveExtensions() {
assertInstalledExtensions(app, RESTEASY_EXTENSION, SMALLRYE_HEALTH_EXTENSION);

// The health endpoint should be now available
app.start();
untilAsserted(() -> app.given().get("/q/health").then().statusCode(HttpStatus.SC_OK));

untilAsserted(() -> {
app.start();
app.given().get("/q/health").then().statusCode(HttpStatus.SC_OK);
});
app.stop();

// Let's now remove the Smallrye Health extension
result = app.removeExtension(SMALLRYE_HEALTH_EXTENSION);
assertTrue(result.isSuccessful(), SMALLRYE_HEALTH_EXTENSION + " was not uninstalled. Output: " + result.getOutput());

// The health endpoint should be now gone
app.start();
untilAsserted(() -> app.given().get("/q/health").then().statusCode(HttpStatus.SC_NOT_FOUND));
untilAsserted(() -> {
app.start();
app.given().get("/q/health").then().statusCode(HttpStatus.SC_NOT_FOUND);
});
}

private void assertInstalledExtensions(QuarkusCliRestService app, String... expectedExtensions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ public void shouldCreateApplicationWithCodeStarter() {
assertInstalledExtensions(app, RESTEASY_SPRING_WEB_EXTENSION);

// Start using DEV mode
app.start();
untilAsserted(() -> app.given().get("/greeting").then().statusCode(HttpStatus.SC_OK).and().body(is("Hello Spring")));
untilAsserted(() -> {
app.start();
app.given().get("/greeting").then().statusCode(HttpStatus.SC_OK).and().body(is("Hello Spring"));
});
}

@Test
Expand All @@ -100,17 +102,21 @@ public void shouldAddAndRemoveExtensions() {
assertInstalledExtensions(app, RESTEASY_EXTENSION, SMALLRYE_HEALTH_EXTENSION);

// The health endpoint should be now available
app.start();
untilAsserted(() -> app.given().get("/q/health").then().statusCode(HttpStatus.SC_OK));
untilAsserted(() -> {
app.start();
app.given().get("/q/health").then().statusCode(HttpStatus.SC_OK);
});
app.stop();

// Let's now remove the Smallrye Health extension
result = app.removeExtension(SMALLRYE_HEALTH_EXTENSION);
assertTrue(result.isSuccessful(), SMALLRYE_HEALTH_EXTENSION + " was not uninstalled. Output: " + result.getOutput());

// The health endpoint should be now gone
app.start();
untilAsserted(() -> app.given().get("/q/health").then().statusCode(HttpStatus.SC_NOT_FOUND));
untilAsserted(() -> {
app.start();
app.given().get("/q/health").then().statusCode(HttpStatus.SC_NOT_FOUND);
});
}

private void assertInstalledExtensions(QuarkusCliRestService app, String... expectedExtensions) {
Expand Down

0 comments on commit 819de5e

Please sign in to comment.