Skip to content

Commit

Permalink
Fix OpenShiftPostgresqlTransactionGeneralUsageIT when run with img fr…
Browse files Browse the repository at this point in the history
…om RH registry
  • Loading branch information
michalvavrik committed Jun 28, 2024
1 parent f2cad72 commit 6c00f4d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 14 deletions.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@
<!-- Product Services -->
<rhbk.image>${rhbk.image}</rhbk.image>
<postgresql.10.image>registry.redhat.io/rhel8/postgresql-10</postgresql.10.image>
<postgresql.latest.image>registry.redhat.io/rhel9/postgresql-15</postgresql.latest.image>
<mysql.80.image>registry.redhat.io/rhel8/mysql-80</mysql.80.image>
<mariadb.103.image>registry.redhat.io/rhel8/mariadb-103</mariadb.103.image>
<mariadb.105.image>registry.redhat.io/rhel8/mariadb-105</mariadb.105.image>
Expand Down Expand Up @@ -860,6 +861,7 @@
<amqbroker.image>registry.redhat.io/amq7/amq-broker-rhel8:7.11</amqbroker.image>
<rhbk.image>${rhbk.image}</rhbk.image>
<postgresql.10.image>registry.redhat.io/rhel8/postgresql-10</postgresql.10.image>
<postgresql.latest.image>registry.redhat.io/rhel9/postgresql-15</postgresql.latest.image>
<mysql.80.image>registry.redhat.io/rhel8/mysql-80</mysql.80.image>
<mariadb.103.image>registry.redhat.io/rhel8/mariadb-103</mariadb.103.image>
<mariadb.105.image>registry.redhat.io/rhel8/mariadb-105</mariadb.105.image>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.quarkus.ts.transactions;

import io.quarkus.test.bootstrap.PostgresqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.ts.transactions.recovery.TransactionExecutor;

public abstract class AbstractPostgresqlTransactionGeneralUsageIT extends TransactionCommons {

static final int POSTGRESQL_PORT = 5432;

@Override
protected TransactionExecutor getTransactionExecutorUsedForRecovery() {
return TransactionExecutor.TRANSACTIONAL_ANNOTATION;
}

protected static RestService createQuarkusApp(PostgresqlService database) {
return new RestService().withProperties("postgresql.properties")
.withProperty("quarkus.otel.exporter.otlp.traces.endpoint", jaeger::getCollectorUrl)
.withProperty("quarkus.datasource.jdbc.telemetry", "true")
.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
@@ -1,8 +1,26 @@
package io.quarkus.ts.transactions;

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 OpenShiftPostgresqlTransactionGeneralUsageIT extends PostgresqlTransactionGeneralUsageIT {
public class OpenShiftPostgresqlTransactionGeneralUsageIT extends AbstractPostgresqlTransactionGeneralUsageIT {

@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")
.withProperty("PGDATA", "/tmp/psql");

@QuarkusApplication
public static final RestService app = createQuarkusApp(database);

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,21 @@
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;
import io.quarkus.ts.transactions.recovery.TransactionExecutor;

@QuarkusScenario
public class PostgresqlTransactionGeneralUsageIT extends TransactionCommons {
public class PostgresqlTransactionGeneralUsageIT extends AbstractPostgresqlTransactionGeneralUsageIT {

private static final String ENABLE_PREPARED_TRANSACTIONS = "--max_prepared_transactions=100";
static final int POSTGRESQL_PORT = 5432;

@Container(image = "${postgresql.latest.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address", command = ENABLE_PREPARED_TRANSACTIONS)
static final PostgresqlService database = new PostgresqlService().withProperty("PGDATA", "/tmp/psql");

@QuarkusApplication
public static final RestService app = new RestService().withProperties("postgresql.properties")
.withProperty("quarkus.otel.exporter.otlp.traces.endpoint", jaeger::getCollectorUrl)
.withProperty("quarkus.datasource.jdbc.telemetry", "true")
.withProperty("quarkus.datasource.username", database.getUser())
.withProperty("quarkus.datasource.password", database.getPassword())
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl);
public static final RestService app = createQuarkusApp(database);

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

@Override
protected TransactionExecutor getTransactionExecutorUsedForRecovery() {
return TransactionExecutor.TRANSACTIONAL_ANNOTATION;
}
}

0 comments on commit 6c00f4d

Please sign in to comment.