Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix postgres flaky tests #1574

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading