Skip to content

Commit

Permalink
Revert "Change waiting strategy for PG imgs from RH registry till FW …
Browse files Browse the repository at this point in the history
…fixed" (quarkus-qe#2007)

This reverts commit c4ca78c.
  • Loading branch information
michalvavrik authored Sep 13, 2024
1 parent 64fa4aa commit 76627f0
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 150 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
package io.quarkus.ts.external.applications;

import io.quarkus.test.bootstrap.PostgresqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.OpenShiftScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnNative;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.GitRepositoryQuarkusApplication;

@DisabledOnNative(reason = "Native + s2i not supported")
@OpenShiftScenario
public class OpenShiftTodoDemoIT extends AbstractTodoDemoIT {

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = 5432, expectedLog = "Future log output will appear in directory")
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 = TODO_REPO, mavenArgs = "-Dquarkus.package.jar.type=uber-jar" + DEFAULT_OPTIONS)
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 = TODO_REPO, artifact = "todo-backend-1.0-SNAPSHOT.jar", mavenArgs = "-Dquarkus.package.jar.type=uber-jar -Dquarkus.package.add-runner-suffix=false"
+ DEFAULT_OPTIONS)
static final RestService replaced = new RestService()
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

@Override
protected RestService getApp() {
return app;
}

@Override
protected RestService getReplaced() {
return replaced;
}
public class OpenShiftTodoDemoIT extends TodoDemoIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public class OpenShiftWorkshopHeroesIT {

private static final int POSTGRESQL_PORT = 5432;

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "Future log output will appear in directory")
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService database = new PostgresqlService()
.withProperty("PGDATA", "/tmp/psql");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public class OpenShiftWorkshopVillainsIT {

private static final int POSTGRESQL_PORT = 5432;

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "Future log output will appear in directory")
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService database = new PostgresqlService()
.withProperty("PGDATA", "/tmp/psql");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
package io.quarkus.ts.external.applications;

import static org.hamcrest.Matchers.is;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Test;

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;

@DisabledOnNative(reason = "This scenario is using uber-jar, so it's incompatible with Native")
@QuarkusScenario
public class TodoDemoIT extends AbstractTodoDemoIT {
public class TodoDemoIT {
private static final String TODO_REPO = "https://github.com/quarkusio/todo-demo-app.git";
private static final String VERSIONS = "-Dquarkus.platform.group-id=${QUARKUS_PLATFORM_GROUP-ID} -Dquarkus.platform.version=${QUARKUS_PLATFORM_VERSION} ";
private static final String DEFAULT_OPTIONS = " -DskipTests=true " + VERSIONS;

@Container(image = "${postgresql.latest.image}", port = 5432, expectedLog = "listening on IPv4 address")
static PostgresqlService database = new PostgresqlService()
Expand All @@ -27,13 +38,24 @@ public class TodoDemoIT extends AbstractTodoDemoIT {
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

@Override
protected RestService getApp() {
return app;
@Test
public void startsSuccessfully() {
app.given()
.contentType(ContentType.JSON)
.body("{\"title\": \"Use Quarkus\", \"order\": 1, \"url\": \"https://quarkus.io\"}")
.post("/api")
.then()
.statusCode(HttpStatus.SC_CREATED);
}

@Override
protected RestService getReplaced() {
return replaced;
@Test
public void replacedStartsSuccessfully() {
replaced.given()
.accept(ContentType.JSON)
.get("/api")
.then()
.statusCode(HttpStatus.SC_OK)
.body("$.size()", is(1))
.body("title[0]", is("Use Quarkus"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
public class AbstractDbIT {
static final int POSTGRESQL_PORT = 5432;

// FIXME: here PG image must not be hardcoded, we need to use ${postgresql.latest.image} system property;
// however using Red Hat image here would require a lot of refactoring
// we need to address https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 first
@Container(image = "docker.io/postgres:16.1", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static final PostgresqlService database = new PostgresqlService()
.withProperty("PGDATA", "/tmp/psql");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,8 @@
package io.quarkus.ts.hibernate.reactive.openshift;

import io.quarkus.test.bootstrap.PostgresqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.OpenShiftScenario;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;
import io.quarkus.ts.hibernate.reactive.AbstractDatabaseHibernateReactiveIT;
import io.quarkus.ts.hibernate.reactive.PostgresqlDatabaseHibernateReactiveIT;

@OpenShiftScenario
public class OpenShiftPostgresqlHibernateReactiveIT extends AbstractDatabaseHibernateReactiveIT {

private static final String POSTGRES_USER = "quarkus_test";
private static final String POSTGRES_PASSWORD = "quarkus_test";
private static final String POSTGRES_DATABASE = "quarkus_test";
private static final int POSTGRES_PORT = 5432;

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRES_PORT, expectedLog = "Future log output will appear in directory")
static PostgresqlService database = new PostgresqlService()
.withUser(POSTGRES_USER)
.withPassword(POSTGRES_PASSWORD)
.withDatabase(POSTGRES_DATABASE)
.withProperty("PGDATA", "/tmp/psql");

@QuarkusApplication
static RestService app = new RestService().withProperties("postgresql.properties")
.withProperty("quarkus.datasource.username", POSTGRES_USER)
.withProperty("quarkus.datasource.password", POSTGRES_PASSWORD)
.withProperty("quarkus.datasource.reactive.url", database::getReactiveUrl);

@Override
protected RestService getApp() {
return app;
}

public class OpenShiftPostgresqlHibernateReactiveIT extends PostgresqlDatabaseHibernateReactiveIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public class OpenShiftMultiplePersistenceIT extends AbstractMultiplePersistenceI
@Container(image = "${mariadb.103.image}", port = MYSQL_PORT, expectedLog = "Only MySQL server logs after this point")
static MariaDbService mariadb = new MariaDbService();

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "Future log output will appear in directory")
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService postgresql = new PostgresqlService()
.withProperty("PGDATA", "/tmp/psql");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
@OpenShiftScenario
public class OpenShiftPostgresqlTransactionGeneralUsageIT extends AbstractPostgresqlTransactionGeneralUsageIT {

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "Future log output will appear in directory")
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static final PostgresqlService database = new PostgresqlService()
// following env variable is accepted by PG images from Red Hat registry
.withProperty("POSTGRESQL_MAX_PREPARED_TRANSACTIONS", "100")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
package io.quarkus.ts.reactive.rest.data.panache;

import io.quarkus.test.bootstrap.PostgresqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.OpenShiftScenario;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

@OpenShiftScenario
public class OpenShiftPostgresqlPanacheResourceIT extends AbstractPanacheResourceIT {

private static final int POSTGRESQL_PORT = 5432;

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "Future log output will appear in directory")
public static final PostgresqlService database = new PostgresqlService()
.withProperty("POSTGRES_DB", "mydb")
.withProperty("PGDATA", "/tmp/psql");

@QuarkusApplication
public static final RestService app = new RestService().withProperties("postgresql.properties")
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

public class OpenShiftPostgresqlPanacheResourceIT extends PostgresqlPanacheResourceIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@QuarkusScenario
public class PostgresqlPanacheResourceIT extends AbstractPanacheResourceIT {

private static final int POSTGRESQL_PORT = 5432;
static final int POSTGRESQL_PORT = 5432;

@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
public static final PostgresqlService database = new PostgresqlService()
Expand All @@ -21,5 +21,4 @@ public class PostgresqlPanacheResourceIT extends AbstractPanacheResourceIT {
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public class OpenShiftPostgresqlDatabaseIT extends AbstractSqlDatabaseIT {

static final int POSTGRESQL_PORT = 5432;

// FIXME: change expected log when https://github.com/quarkus-qe/quarkus-test-framework/issues/1183 is fixed
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "Future log output will appear in directory")
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService database = new PostgresqlService()
.withProperty("PGDATA", "/tmp/psql");

Expand Down

0 comments on commit 76627f0

Please sign in to comment.