Skip to content

Commit

Permalink
Merge pull request #1151 from jedla97/enable-tod-app
Browse files Browse the repository at this point in the history
Enable TODO app
  • Loading branch information
michalvavrik authored Jun 5, 2024
2 parents f4a881f + 9d85cc8 commit 0ab0d97
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 15 deletions.
5 changes: 5 additions & 0 deletions examples/external-applications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@
<artifactId>quarkus-test-openshift</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package io.quarkus.qe;

import org.junit.jupiter.api.Disabled;

import io.quarkus.test.scenarios.OpenShiftScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnNative;

// TODO: enable when Quarkus TODO app migrates to Quarkus 3
@Disabled("Disabled until Quarkus TODO app migrates to Quarkus 3")
@DisabledOnNative(reason = "Native + s2i not supported")
@OpenShiftScenario
public class OpenShiftTodoDemoIT extends TodoDemoIT {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,84 @@
package io.quarkus.qe;

import static org.hamcrest.Matchers.is;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import io.quarkus.test.bootstrap.PostgresqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnNative;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.GitRepositoryQuarkusApplication;
import io.restassured.http.ContentType;

// TODO: enable when Quarkus QuickStarts migrates to Quarkus 3
@Disabled("Disabled until Quarkus 3 is released and TODO application migrates to it")
@DisabledOnNative(reason = "This scenario is using uber-jar, so it's incompatible with Native")
@QuarkusScenario
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class TodoDemoIT {
private static final String REPO = "https://github.com/quarkusio/todo-demo-app.git";
private static final String DEFAULT_ARGS = "-DskipTests=true -Dquarkus.platform.group-id=${QUARKUS_PLATFORM_GROUP-ID} -Dquarkus.platform.version=${QUARKUS_PLATFORM_VERSION} ";
private static final String UBER = "-Dquarkus.package.jar.type=uber-jar ";
private static final String NO_SUFFIX = "-Dquarkus.package.jar.add-runner-suffix=false";

@Container(image = "${postgresql.image}", port = 5432, expectedLog = "is ready")
static PostgresqlService database = new PostgresqlService()
// store data in /tmp/psql as in OpenShift we don't have permissions to /var/lib/postgresql/data
.withProperty("PGDATA", "/tmp/psql");

@GitRepositoryQuarkusApplication(repo = REPO, mavenArgs = DEFAULT_ARGS + UBER)
static final RestService app = new RestService();
static final RestService app = new RestService()
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

@GitRepositoryQuarkusApplication(repo = REPO, artifact = "todo-backend-1.0-SNAPSHOT-runner.jar", mavenArgs = DEFAULT_ARGS
+ UBER)
static final RestService explicit = new RestService();

private static final String NO_SUFFIX = "-Dquarkus.package.add-runner-suffix=false";
static final RestService explicit = new RestService()
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

@GitRepositoryQuarkusApplication(repo = REPO, artifact = "todo-backend-1.0-SNAPSHOT.jar", mavenArgs = DEFAULT_ARGS + UBER
+ NO_SUFFIX)
static final RestService unsuffixed = new RestService();
static final RestService unsuffixed = new RestService()
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

@Test
@Order(1)
public void verify() {
app.given().get().then().statusCode(HttpStatus.SC_OK);
app.given()
.contentType(ContentType.JSON)
.body("{\"title\": \"Use Quarkus\", \"order\": 1, \"url\": \"https://quarkus.io\"}")
.post("/api")
.then()
.statusCode(HttpStatus.SC_CREATED);
}

@Test
@Order(2)
public void verifyExplicitArtifact() {
explicit.given().get().then().statusCode(HttpStatus.SC_OK);
explicit.given()
.accept(ContentType.JSON)
.get("/api/1")
.then()
.statusCode(HttpStatus.SC_OK)
.body("title", is("Use Quarkus"));
}

@Test
@Order(3)
public void verifyNoSuffix() {
unsuffixed.given().get().then().statusCode(HttpStatus.SC_OK);
unsuffixed.given()
.pathParam("id", 1)
.delete("/api/{id}")
.then()
.statusCode(HttpStatus.SC_NO_CONTENT);
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ts.appuberjar.openshift.template=/uber-jar-quarkus-s2i-source-build-template.yml
ts.database.openshift.use-internal-service-as-url=true

0 comments on commit 0ab0d97

Please sign in to comment.