Skip to content

Commit

Permalink
ci: fix postgres flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Sep 23, 2024
1 parent 49c4d08 commit 7e63df3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 7e63df3

Please sign in to comment.