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
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
@@ -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
Original file line number Diff line number Diff line change
@@ -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

Unchanged files with check annotations Beta

version: '3'
services:
edc-runtime:

Check warning on line 24 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[MEDIUM] Healthcheck Not Set

Check containers periodically to see if they are running properly.

Check warning on line 24 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[MEDIUM] Host Namespace is Shared

The hosts process namespace should not be shared by containers

Check warning on line 24 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[MEDIUM] Memory Not Limited

Memory limits should be defined for each container. This prevents potential resource exhaustion by ensuring that containers consume not more than the designated amount of memory

Check warning on line 24 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[MEDIUM] Security Opt Not Set

Attribute 'security_opt' should be defined.

Check warning on line 24 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[LOW] Container Capabilities Unrestricted

Some capabilities are not needed in certain (or any) containers. Make sure that you only add capabilities that your container needs. Drop unnecessary capabilities as well.

Check warning on line 24 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[LOW] Cpus Not Limited

CPU limits should be set because if the system has CPU time free, a container is guaranteed to be allocated as much CPU as it requests
image: edc-dast-runtime:latest
volumes:
- type: bind
source: ./edc-dast-runtime/configuration.properties
target: /app/configuration.properties
ports:

Check warning on line 30 in samples/edc-dast/docker-compose.yaml

GitHub Actions / Analyze

[MEDIUM] Container Traffic Not Bound To Host Interface

Incoming container traffic should be bound to a specific host interface
- "8282:8282"
- "8181:8181"
- "8989:8989"