Skip to content

Commit

Permalink
feat: remove the github postgres service and use Testcontainers (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
ununhexium authored Feb 7, 2024
1 parent 6fd6425 commit 78d92b0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 47 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/src/test/java/de/sovity/edc/e2e/ApiWrapperDemoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions tests/src/test/java/de/sovity/edc/e2e/UiApiWrapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 78d92b0

Please sign in to comment.