From 78d92b07812d6dedf7e388dbb3ad94c4bb6f31cf Mon Sep 17 00:00:00 2001 From: Christophe Loiseau Date: Wed, 7 Feb 2024 14:25:21 +0100 Subject: [PATCH] feat: remove the github postgres service and use Testcontainers (#779) --- .github/workflows/ci.yml | 35 ------------------- .../de/sovity/edc/e2e/ApiWrapperDemoTest.java | 6 ++-- .../edc/e2e/ManagementApiTransferTest.java | 6 ++-- .../edc/e2e/Ms8ConnectorMigrationTest.java | 6 ++-- .../de/sovity/edc/e2e/UiApiWrapperTest.java | 6 ++-- 5 files changed, 12 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c23ee2701..dd4f3bb9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,41 +21,6 @@ jobs: permissions: contents: read packages: write - services: - postgres1: - image: postgres:15 - env: - POSTGRES_USER: edc - POSTGRES_PASSWORD: edc - POSTGRES_DB: edc - ports: - - 54321:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - postgres2: - image: postgres:15 - env: - POSTGRES_USER: edc - POSTGRES_PASSWORD: edc - POSTGRES_DB: edc - ports: - - 54322:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - SKIP_TESTCONTAINERS: true - TEST_POSTGRES_1_JDBC_URL: jdbc:postgresql://localhost:54321/edc - TEST_POSTGRES_1_JDBC_USER: edc - TEST_POSTGRES_1_JDBC_PASSWORD: edc - TEST_POSTGRES_2_JDBC_URL: jdbc:postgresql://localhost:54322/edc - TEST_POSTGRES_2_JDBC_USER: edc - TEST_POSTGRES_2_JDBC_PASSWORD: edc steps: - uses: FranzDiebold/github-env-vars-action@v2 - uses: actions/checkout@v3 diff --git a/tests/src/test/java/de/sovity/edc/e2e/ApiWrapperDemoTest.java b/tests/src/test/java/de/sovity/edc/e2e/ApiWrapperDemoTest.java index d57e6efcb..dd0a9916c 100644 --- a/tests/src/test/java/de/sovity/edc/e2e/ApiWrapperDemoTest.java +++ b/tests/src/test/java/de/sovity/edc/e2e/ApiWrapperDemoTest.java @@ -35,7 +35,7 @@ import de.sovity.edc.extension.e2e.connector.ConnectorRemote; import de.sovity.edc.extension.e2e.connector.MockDataAddressRemote; import de.sovity.edc.extension.e2e.db.TestDatabase; -import de.sovity.edc.extension.e2e.db.TestDatabaseFactory; +import de.sovity.edc.extension.e2e.db.TestDatabaseViaTestcontainers; import de.sovity.edc.utils.jsonld.vocab.Prop; import org.awaitility.Awaitility; import org.eclipse.edc.junit.extensions.EdcExtension; @@ -63,9 +63,9 @@ class ApiWrapperDemoTest { static EdcExtension consumerEdcContext = new EdcExtension(); @RegisterExtension - static final TestDatabase PROVIDER_DATABASE = TestDatabaseFactory.getTestDatabase(1); + static final TestDatabase PROVIDER_DATABASE = new TestDatabaseViaTestcontainers(); @RegisterExtension - static final TestDatabase CONSUMER_DATABASE = TestDatabaseFactory.getTestDatabase(2); + static final TestDatabase CONSUMER_DATABASE = new TestDatabaseViaTestcontainers(); private ConnectorRemote providerConnector; private ConnectorRemote consumerConnector; diff --git a/tests/src/test/java/de/sovity/edc/e2e/ManagementApiTransferTest.java b/tests/src/test/java/de/sovity/edc/e2e/ManagementApiTransferTest.java index 657071ac8..169ef34c1 100644 --- a/tests/src/test/java/de/sovity/edc/e2e/ManagementApiTransferTest.java +++ b/tests/src/test/java/de/sovity/edc/e2e/ManagementApiTransferTest.java @@ -16,7 +16,7 @@ import de.sovity.edc.extension.e2e.connector.ConnectorRemote; import de.sovity.edc.extension.e2e.connector.MockDataAddressRemote; import de.sovity.edc.extension.e2e.db.TestDatabase; -import de.sovity.edc.extension.e2e.db.TestDatabaseFactory; +import de.sovity.edc.extension.e2e.db.TestDatabaseViaTestcontainers; import org.eclipse.edc.junit.extensions.EdcExtension; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -40,9 +40,9 @@ class ManagementApiTransferTest { static EdcExtension consumerEdcContext = new EdcExtension(); @RegisterExtension - static final TestDatabase PROVIDER_DATABASE = TestDatabaseFactory.getTestDatabase(1); + static final TestDatabase PROVIDER_DATABASE = new TestDatabaseViaTestcontainers(); @RegisterExtension - static final TestDatabase CONSUMER_DATABASE = TestDatabaseFactory.getTestDatabase(2); + static final TestDatabase CONSUMER_DATABASE = new TestDatabaseViaTestcontainers(); private ConnectorRemote providerConnector; private ConnectorRemote consumerConnector; diff --git a/tests/src/test/java/de/sovity/edc/e2e/Ms8ConnectorMigrationTest.java b/tests/src/test/java/de/sovity/edc/e2e/Ms8ConnectorMigrationTest.java index 6466b9aaa..761782160 100644 --- a/tests/src/test/java/de/sovity/edc/e2e/Ms8ConnectorMigrationTest.java +++ b/tests/src/test/java/de/sovity/edc/e2e/Ms8ConnectorMigrationTest.java @@ -20,7 +20,7 @@ import de.sovity.edc.extension.e2e.connector.ConnectorRemote; import de.sovity.edc.extension.e2e.connector.MockDataAddressRemote; import de.sovity.edc.extension.e2e.db.TestDatabase; -import de.sovity.edc.extension.e2e.db.TestDatabaseFactory; +import de.sovity.edc.extension.e2e.db.TestDatabaseViaTestcontainers; import org.assertj.core.api.SoftAssertions; import org.assertj.core.data.TemporalUnitLessThanOffset; import org.eclipse.edc.junit.extensions.EdcExtension; @@ -54,9 +54,9 @@ class Ms8ConnectorMigrationTest { static EdcExtension consumerEdcContext = new EdcExtension(); @RegisterExtension - static final TestDatabase PROVIDER_DATABASE = TestDatabaseFactory.getTestDatabase(1); + static final TestDatabase PROVIDER_DATABASE = new TestDatabaseViaTestcontainers(); @RegisterExtension - static final TestDatabase CONSUMER_DATABASE = TestDatabaseFactory.getTestDatabase(2); + static final TestDatabase CONSUMER_DATABASE = new TestDatabaseViaTestcontainers(); private ConnectorRemote providerConnector; private ConnectorRemote consumerConnector; diff --git a/tests/src/test/java/de/sovity/edc/e2e/UiApiWrapperTest.java b/tests/src/test/java/de/sovity/edc/e2e/UiApiWrapperTest.java index 86ef30501..f618bdce6 100644 --- a/tests/src/test/java/de/sovity/edc/e2e/UiApiWrapperTest.java +++ b/tests/src/test/java/de/sovity/edc/e2e/UiApiWrapperTest.java @@ -38,7 +38,7 @@ import de.sovity.edc.extension.e2e.connector.ConnectorRemote; import de.sovity.edc.extension.e2e.connector.MockDataAddressRemote; import de.sovity.edc.extension.e2e.db.TestDatabase; -import de.sovity.edc.extension.e2e.db.TestDatabaseFactory; +import de.sovity.edc.extension.e2e.db.TestDatabaseViaTestcontainers; import de.sovity.edc.utils.JsonUtils; import de.sovity.edc.utils.jsonld.vocab.Prop; import jakarta.json.Json; @@ -76,9 +76,9 @@ class UiApiWrapperTest { static EdcExtension consumerEdcContext = new EdcExtension(); @RegisterExtension - static final TestDatabase PROVIDER_DATABASE = TestDatabaseFactory.getTestDatabase(1); + static final TestDatabase PROVIDER_DATABASE = new TestDatabaseViaTestcontainers(); @RegisterExtension - static final TestDatabase CONSUMER_DATABASE = TestDatabaseFactory.getTestDatabase(2); + static final TestDatabase CONSUMER_DATABASE = new TestDatabaseViaTestcontainers(); private ConnectorRemote providerConnector; private ConnectorRemote consumerConnector;