diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 6596f4f0b..16c648237 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -123,14 +123,6 @@ jobs: postgres-tests: runs-on: ubuntu-latest - services: - postgres: - image: postgres:16.1 - ports: - - 5432:5432 - env: - POSTGRES_PASSWORD: password - steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-java diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java index 6719c0a57..8e0a0186b 100644 --- a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java @@ -19,12 +19,15 @@ package org.eclipse.tractusx.edc.tests.runtimes; +import com.github.dockerjava.api.model.ExposedPort; +import org.eclipse.edc.util.io.Ports; import org.junit.jupiter.api.extension.ExtensionContext; import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.containers.wait.strategy.Wait; import java.sql.DriverManager; import java.sql.SQLException; +import java.util.List; import java.util.Map; import static java.lang.String.format; @@ -45,10 +48,12 @@ public PgRuntimeExtension(String moduleName, String runtimeName, String bpn, Map this.dbName = runtimeName.toLowerCase(); postgreSqlContainer = new PostgreSQLContainer<>(POSTGRES_IMAGE_NAME) .withLabel("runtime", dbName) - .withExposedPorts(5432) .withUsername(USER) .withPassword(PASSWORD) .withDatabaseName(dbName); + + postgreSqlContainer.setPortBindings(List.of("%d:5432".formatted(Ports.getFreePort()))); + } @Override