Skip to content

Commit

Permalink
Remove PostgreSQL image workaround (#1022)
Browse files Browse the repository at this point in the history
* Remove PostgreSQL image workaround

Removes workaround for a failure reported in
quarkus-qe/quarkus-test-framework#641 and
observed in #971.

* Due to a test framework issue we are going to reuse postgres docker container image

---------

Co-authored-by: pablo gonzalez granados <[email protected]>
  • Loading branch information
jsmrcka and pablo gonzalez granados authored Mar 2, 2023
1 parent eeb614c commit 119d8de
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@
<ts.global.s2i.quarkus.native.builder.image>${ts.global.s2i.quarkus.native.builder.image}</ts.global.s2i.quarkus.native.builder.image>
<!-- Services used in test suite -->
<postgresql.latest.image>${postgresql.latest.image}</postgresql.latest.image>
<!-- FIXME: if the same image name is used in two test classes, the second one fails -->
<postgresql.also.latest.image>docker.io/library/postgres:15.1</postgresql.also.latest.image>
<!-- TODO: investigate further in https://github.com/quarkus-qe/quarkus-test-suite/issues/627 -->
<elastic.71.image>docker.io/bitnami/elasticsearch:7.17.6</elastic.71.image>
<!--TODO change into 5.7 when this fixed https://github.com/docker-library/mysql/issues/844 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ public class PostgresqlDatabaseIT extends AbstractSqlDatabaseIT {

static final int POSTGRESQL_PORT = 5432;

// TODO rename "postgresql" database to "database" once this issue is fixed
// quarkus-qe/quarkus-test-framework#641
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService database = new PostgresqlService()
static PostgresqlService postgresql = new PostgresqlService()
//fixme https://github.com/quarkus-qe/quarkus-test-framework/issues/455
.withProperty("POSTGRES_USER", "user")
.withProperty("POSTGRES_PASSWORD", "user")
.withProperty("POSTGRES_DB", "mydb");

@QuarkusApplication
static 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);
.withProperty("quarkus.datasource.username", postgresql.getUser())
.withProperty("quarkus.datasource.password", postgresql.getPassword())
.withProperty("quarkus.datasource.jdbc.url", postgresql::getJdbcUrl);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ public class XAPostgresIT extends AbstractSqlDatabaseIT {

static final int POSTGRESQL_PORT = 5432;

@Container(image = "${postgresql.also.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService database = new PostgresqlService()
// TODO rename "postgresql" database to "database" once this issue is fixed
// quarkus-qe/quarkus-test-framework#641
@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address")
static PostgresqlService postgresql = new PostgresqlService()
.withUser("user")
.withPassword("user")
.withDatabase("mydb");

@QuarkusApplication
static RestService app = new RestService().withProperties("postgresql.properties")
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.username", postgresql.getUser())
.withProperty("quarkus.datasource.password", postgresql.getPassword())
.withProperty("quarkus.datasource.jdbc.transactions", "xa")
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);
.withProperty("quarkus.datasource.jdbc.url", postgresql::getJdbcUrl);
}
2 changes: 2 additions & 0 deletions sql-db/sql-app/src/test/resources/test.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ts.app.log.enable=true
ts.database.log.enable=true
ts.postgresql.log.enable=true
ts.database.container.delete.image.on.stop=true
ts.database.openshift.use-internal-service-as-url=true
ts.postgresql.openshift.use-internal-service-as-url=true
ts.db2.container.privileged-mode=true
ts.db2.startup.timeout=10m

0 comments on commit 119d8de

Please sign in to comment.