From 857299b1999f9f3196498a267244f5554fea5272 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Fri, 13 Oct 2023 09:13:41 -0400 Subject: [PATCH 01/28] first outline --- .../pact/TDRPactTest.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java new file mode 100644 index 000000000..8f3b660d0 --- /dev/null +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -0,0 +1,65 @@ +package org.databiosphere.workspacedataservice.pact; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import au.com.dius.pact.consumer.MockServer; +import au.com.dius.pact.consumer.dsl.PactDslWithProvider; +import au.com.dius.pact.consumer.junit5.PactConsumerTestExt; +import au.com.dius.pact.consumer.junit5.PactTestFor; +import au.com.dius.pact.core.model.PactSpecVersion; +import au.com.dius.pact.core.model.RequestResponsePact; +import au.com.dius.pact.core.model.annotations.Pact; +import java.util.UUID; +import org.databiosphere.workspacedataservice.datarepo.DataRepoClientFactory; +import org.databiosphere.workspacedataservice.datarepo.DataRepoDao; +import org.databiosphere.workspacedataservice.datarepo.DataRepoException; +import org.databiosphere.workspacedataservice.datarepo.HttpDataRepoClientFactory; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +@Tag("pact-test") +@ExtendWith(PactConsumerTestExt.class) +class TDRPactTest { + + @BeforeEach + void setUp() { + // Without this setup, the HttpClient throws a "No thread-bound request found" error + MockHttpServletRequest request = new MockHttpServletRequest(); + // Set the mock request as the current request context + RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); + } + + static final String dummySnapshotId = "12345678-abc9-012d-3456-e7fab89cd01e"; + + @Pact(consumer = "wds-consumer", provider = "tdr-provider") + public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { + return builder + .given("snapshot doesn't exist") + .uponReceiving("a snapshot request") + .pathFromProviderState( + "/api/repository/v1/snapshots/${dummySnapshotId}", + String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .method("GET") + .willRespondWith() + .status(404) + .body("") + .toPact(); + } + + @Test + @PactTestFor(pactMethod = "noSnapshotPact", pactVersion = PactSpecVersion.V3) + void testNoSnapshot(MockServer mockServer) { + DataRepoClientFactory clientFactory = new HttpDataRepoClientFactory(mockServer.getUrl()); + DataRepoDao dataRepoDao = new DataRepoDao(clientFactory); + + assertThrows( + DataRepoException.class, + () -> dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)), + "nonexistent snapshot should return 404"); + } +} From 55731521d4d63ddc35410302b230d4eafc54b275 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Fri, 13 Oct 2023 16:28:10 -0400 Subject: [PATCH 02/28] aha --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 8f3b660d0..4760da8d3 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -44,10 +44,10 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .pathFromProviderState( "/api/repository/v1/snapshots/${dummySnapshotId}", String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .query("include=TABLES") .method("GET") .willRespondWith() .status(404) - .body("") .toPact(); } From 4ac9d9167f44354ab3991b1bae4f143c93e0d2c4 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Mon, 16 Oct 2023 11:05:52 -0400 Subject: [PATCH 03/28] flesh out more pacts --- .../pact/TDRPactTest.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 4760da8d3..0cc2733f4 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -1,14 +1,17 @@ package org.databiosphere.workspacedataservice.pact; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import au.com.dius.pact.consumer.MockServer; +import au.com.dius.pact.consumer.dsl.PactDslJsonBody; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.consumer.junit5.PactConsumerTestExt; import au.com.dius.pact.consumer.junit5.PactTestFor; import au.com.dius.pact.core.model.PactSpecVersion; import au.com.dius.pact.core.model.RequestResponsePact; import au.com.dius.pact.core.model.annotations.Pact; +import bio.terra.datarepo.model.SnapshotModel; import java.util.UUID; import org.databiosphere.workspacedataservice.datarepo.DataRepoClientFactory; import org.databiosphere.workspacedataservice.datarepo.DataRepoDao; @@ -51,6 +54,41 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .toPact(); } + @Pact(consumer = "wds-consumer", provider = "tdr-provider") + public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { + return builder + .given("user does not have access to snapshot") + .uponReceiving("a snapshot request") + .pathFromProviderState( + "/api/repository/v1/snapshots/${dummySnapshotId}", + String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .query("include=TABLES") + .method("GET") + .willRespondWith() + .status(403) + .toPact(); + } + + @Pact(consumer = "wds-consumer", provider = "tdr-provider") + public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider builder) { + // Current use of datarepo snapshot only relies on id and name + // Future development should update expected response shape to include fields we need + var snapshotResponseShape = + new PactDslJsonBody().stringValue("id", dummySnapshotId).stringType("name"); + return builder + .given("user has access to snapshot") + .uponReceiving("a snapshot request") + .pathFromProviderState( + "/api/repository/v1/snapshots/${dummySnapshotId}", + String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .query("include=TABLES") + .method("GET") + .willRespondWith() + .status(200) + .body(snapshotResponseShape) + .toPact(); + } + @Test @PactTestFor(pactMethod = "noSnapshotPact", pactVersion = PactSpecVersion.V3) void testNoSnapshot(MockServer mockServer) { @@ -62,4 +100,28 @@ void testNoSnapshot(MockServer mockServer) { () -> dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)), "nonexistent snapshot should return 404"); } + + @Test + @PactTestFor(pactMethod = "noAccessToSnapshotPact", pactVersion = PactSpecVersion.V3) + void testNoAccessToSnapshot(MockServer mockServer) { + DataRepoClientFactory clientFactory = new HttpDataRepoClientFactory(mockServer.getUrl()); + DataRepoDao dataRepoDao = new DataRepoDao(clientFactory); + + assertThrows( + DataRepoException.class, + () -> dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)), + "nonexistent snapshot should return 403"); + } + + @Test + @PactTestFor(pactMethod = "userHasAccessToSnapshotPact", pactVersion = PactSpecVersion.V3) + void testUserHasAccessToSnapshot(MockServer mockServer) { + DataRepoClientFactory clientFactory = new HttpDataRepoClientFactory(mockServer.getUrl()); + DataRepoDao dataRepoDao = new DataRepoDao(clientFactory); + + SnapshotModel snapshot = dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)); + assertNotNull(snapshot, "Snapshot request should return a snapshot"); + assertNotNull(snapshot.getId(), "Snapshot response should have an id"); + assertNotNull(snapshot.getName(), "Snapshot response should have a name"); + } } From f3c28776af1895520fbbf1cf75851b523ee00a01 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Wed, 18 Oct 2023 16:03:15 -0400 Subject: [PATCH 04/28] try different body --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 0cc2733f4..7c42567fe 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -50,7 +50,9 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .query("include=TABLES") .method("GET") .willRespondWith() - .status(404) + // .status(404) + .body( + "{\"message\": \"Snapshot not found - id: 12345678-abc9-012d-3456-e7fab89cd01e\",\"errorDetail\": []}") .toPact(); } From d10f632241cb59a6f527135814012ce6dbff2911 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 19 Oct 2023 10:24:00 -0400 Subject: [PATCH 05/28] try plain path --- .../workspacedataservice/pact/TDRPactTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 7c42567fe..79e307938 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -44,13 +44,11 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { return builder .given("snapshot doesn't exist") .uponReceiving("a snapshot request") - .pathFromProviderState( - "/api/repository/v1/snapshots/${dummySnapshotId}", - String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .path("/api/repository/v1/snapshots/12345678-abc9-012d-3456-e7fab89cd01e") .query("include=TABLES") .method("GET") .willRespondWith() - // .status(404) + .status(404) .body( "{\"message\": \"Snapshot not found - id: 12345678-abc9-012d-3456-e7fab89cd01e\",\"errorDetail\": []}") .toPact(); From d3d5a3d5fbb87efa8d81bf6e6ed7619ecbddea26 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Fri, 20 Oct 2023 13:52:55 -0400 Subject: [PATCH 06/28] test --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 79e307938..a6d7b6bcd 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -97,7 +97,7 @@ void testNoSnapshot(MockServer mockServer) { assertThrows( DataRepoException.class, - () -> dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)), + () -> dataRepoDao.getSnapshot(UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e")), "nonexistent snapshot should return 404"); } From 05e2f8babb24bd47151eefcd0bc3c85cd3ddcc5b Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Fri, 20 Oct 2023 13:59:01 -0400 Subject: [PATCH 07/28] no variables in path anywhere --- .../workspacedataservice/pact/TDRPactTest.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index a6d7b6bcd..5357591bd 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -59,9 +59,7 @@ public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { return builder .given("user does not have access to snapshot") .uponReceiving("a snapshot request") - .pathFromProviderState( - "/api/repository/v1/snapshots/${dummySnapshotId}", - String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .path("/api/repository/v1/snapshots/12345678-abc9-012d-3456-e7fab89cd01e") .query("include=TABLES") .method("GET") .willRespondWith() @@ -78,9 +76,7 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build return builder .given("user has access to snapshot") .uponReceiving("a snapshot request") - .pathFromProviderState( - "/api/repository/v1/snapshots/${dummySnapshotId}", - String.format("/api/repository/v1/snapshots/%s", dummySnapshotId)) + .path("/api/repository/v1/snapshots/12345678-abc9-012d-3456-e7fab89cd01e") .query("include=TABLES") .method("GET") .willRespondWith() @@ -109,7 +105,7 @@ void testNoAccessToSnapshot(MockServer mockServer) { assertThrows( DataRepoException.class, - () -> dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)), + () -> dataRepoDao.getSnapshot(UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e")), "nonexistent snapshot should return 403"); } @@ -119,7 +115,8 @@ void testUserHasAccessToSnapshot(MockServer mockServer) { DataRepoClientFactory clientFactory = new HttpDataRepoClientFactory(mockServer.getUrl()); DataRepoDao dataRepoDao = new DataRepoDao(clientFactory); - SnapshotModel snapshot = dataRepoDao.getSnapshot(UUID.fromString(dummySnapshotId)); + SnapshotModel snapshot = + dataRepoDao.getSnapshot(UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e")); assertNotNull(snapshot, "Snapshot request should return a snapshot"); assertNotNull(snapshot.getId(), "Snapshot response should have an id"); assertNotNull(snapshot.getName(), "Snapshot response should have a name"); From 8cd4401f4cc511e4de72045f43dbd93558cc0613 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Tue, 24 Oct 2023 14:13:34 -0400 Subject: [PATCH 08/28] Update publish-pacts.yml temporarily publish only tdr pacts --- .github/workflows/publish-pacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index 23e20bd4f..fd1286bc4 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -65,7 +65,7 @@ jobs: - name: Output consumer contract as non-breaking base64 string id: encode-pact run: | - NON_BREAKING_B64=$(cat service/build/pacts/wds-consumer-sam-provider.json | base64 -w 0) + NON_BREAKING_B64=$(cat service/build/pacts/wds-consumer-tdr-provider.json | base64 -w 0) echo "pact-b64=${NON_BREAKING_B64}" >> $GITHUB_OUTPUT publish-pact-job: From e8895d85e98aaf62cae5acf239466941eb5df955 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Tue, 24 Oct 2023 14:25:19 -0400 Subject: [PATCH 09/28] Update publish-pacts.yml update checkout --- .github/workflows/publish-pacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index fd1286bc4..3e0f4eab2 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -53,7 +53,7 @@ jobs: steps: - name: Checkout current code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK uses: actions/setup-java@v2 From 03f73022f0798397ebf831643699aad877defcb8 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Tue, 24 Oct 2023 15:02:26 -0400 Subject: [PATCH 10/28] rename tdr-provider --- .../workspacedataservice/pact/TDRPactTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 5357591bd..6d2f6677a 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -39,7 +39,7 @@ void setUp() { static final String dummySnapshotId = "12345678-abc9-012d-3456-e7fab89cd01e"; - @Pact(consumer = "wds-consumer", provider = "tdr-provider") + @Pact(consumer = "wds-consumer", provider = "tdr") public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { return builder .given("snapshot doesn't exist") @@ -54,7 +54,7 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .toPact(); } - @Pact(consumer = "wds-consumer", provider = "tdr-provider") + @Pact(consumer = "wds-consumer", provider = "tdr") public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { return builder .given("user does not have access to snapshot") @@ -67,7 +67,7 @@ public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { .toPact(); } - @Pact(consumer = "wds-consumer", provider = "tdr-provider") + @Pact(consumer = "wds-consumer", provider = "tdr") public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider builder) { // Current use of datarepo snapshot only relies on id and name // Future development should update expected response shape to include fields we need From 11b95a5b42395692b1b61b2342500db512e41faf Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Tue, 24 Oct 2023 15:03:00 -0400 Subject: [PATCH 11/28] Update publish-pacts.yml rename pact --- .github/workflows/publish-pacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index 3e0f4eab2..21b99254a 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -65,7 +65,7 @@ jobs: - name: Output consumer contract as non-breaking base64 string id: encode-pact run: | - NON_BREAKING_B64=$(cat service/build/pacts/wds-consumer-tdr-provider.json | base64 -w 0) + NON_BREAKING_B64=$(cat service/build/pacts/wds-consumer-tdr.json | base64 -w 0) echo "pact-b64=${NON_BREAKING_B64}" >> $GITHUB_OUTPUT publish-pact-job: From 47e51fddff9815c24c0182a9e38f73291ebcb70f Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 26 Oct 2023 15:09:53 -0400 Subject: [PATCH 12/28] rename pacticipants --- .../workspacedataservice/pact/TDRPactTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 6d2f6677a..98c0b6b8a 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -39,7 +39,7 @@ void setUp() { static final String dummySnapshotId = "12345678-abc9-012d-3456-e7fab89cd01e"; - @Pact(consumer = "wds-consumer", provider = "tdr") + @Pact(consumer = "terra-workspace-data-service", provider = "datarepo") public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { return builder .given("snapshot doesn't exist") @@ -54,7 +54,7 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .toPact(); } - @Pact(consumer = "wds-consumer", provider = "tdr") + @Pact(consumer = "terra-workspace-data-service", provider = "datarepo") public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { return builder .given("user does not have access to snapshot") @@ -67,7 +67,7 @@ public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { .toPact(); } - @Pact(consumer = "wds-consumer", provider = "tdr") + @Pact(consumer = "terra-workspace-data-service", provider = "datarepo") public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider builder) { // Current use of datarepo snapshot only relies on id and name // Future development should update expected response shape to include fields we need From 9a916c35c90af238d537d46958e02fc0864ef14e Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 26 Oct 2023 15:16:54 -0400 Subject: [PATCH 13/28] Update publish-pacts.yml rename pacticipants --- .github/workflows/publish-pacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index 21b99254a..3e1729fc6 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -65,7 +65,7 @@ jobs: - name: Output consumer contract as non-breaking base64 string id: encode-pact run: | - NON_BREAKING_B64=$(cat service/build/pacts/wds-consumer-tdr.json | base64 -w 0) + NON_BREAKING_B64=$(cat service/build/pacts/terra-workspace-data-service-datarepo.json | base64 -w 0) echo "pact-b64=${NON_BREAKING_B64}" >> $GITHUB_OUTPUT publish-pact-job: From 61b117d045eab454eeef380345bb742943765f1a Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Mon, 30 Oct 2023 11:37:40 -0400 Subject: [PATCH 14/28] re-rename consumer --- .../workspacedataservice/pact/TDRPactTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 98c0b6b8a..d54807749 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -39,7 +39,7 @@ void setUp() { static final String dummySnapshotId = "12345678-abc9-012d-3456-e7fab89cd01e"; - @Pact(consumer = "terra-workspace-data-service", provider = "datarepo") + @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { return builder .given("snapshot doesn't exist") @@ -54,7 +54,7 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .toPact(); } - @Pact(consumer = "terra-workspace-data-service", provider = "datarepo") + @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { return builder .given("user does not have access to snapshot") @@ -67,7 +67,7 @@ public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { .toPact(); } - @Pact(consumer = "terra-workspace-data-service", provider = "datarepo") + @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider builder) { // Current use of datarepo snapshot only relies on id and name // Future development should update expected response shape to include fields we need From f09542925fb224697c6bf9d4f1ab49f916660f25 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Wed, 1 Nov 2023 13:44:58 -0400 Subject: [PATCH 15/28] Update publish-pacts.yml --- .github/workflows/publish-pacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index 3e1729fc6..53502bd91 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -65,7 +65,7 @@ jobs: - name: Output consumer contract as non-breaking base64 string id: encode-pact run: | - NON_BREAKING_B64=$(cat service/build/pacts/terra-workspace-data-service-datarepo.json | base64 -w 0) + NON_BREAKING_B64=$(cat service/build/pacts/wds-datarepo.json | base64 -w 0) echo "pact-b64=${NON_BREAKING_B64}" >> $GITHUB_OUTPUT publish-pact-job: From d63d575be71a35ddcbdce78e8336608e232d4370 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Wed, 1 Nov 2023 13:58:13 -0400 Subject: [PATCH 16/28] remove unnecessary body expectation --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index d54807749..d59ebce90 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -49,8 +49,6 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { .method("GET") .willRespondWith() .status(404) - .body( - "{\"message\": \"Snapshot not found - id: 12345678-abc9-012d-3456-e7fab89cd01e\",\"errorDetail\": []}") .toPact(); } From 41c5e3ecbd764a339013fa9016cad9fc0962b100 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Wed, 1 Nov 2023 13:59:27 -0400 Subject: [PATCH 17/28] Update publish-pacts.yml temporary update for testing --- .github/workflows/publish-pacts.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index 53502bd91..1cede3bdd 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -7,6 +7,7 @@ on: push: branches: - main + - aj-1188-tdr-consumer paths-ignore: [ '**.md' ] jobs: From 5b536d1c09beea216002fe217ad561d43216a3f6 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 09:19:41 -0400 Subject: [PATCH 18/28] small pr comment improvements --- .../workspacedataservice/pact/TDRPactTest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index d59ebce90..684637a18 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -1,5 +1,6 @@ package org.databiosphere.workspacedataservice.pact; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -12,6 +13,7 @@ import au.com.dius.pact.core.model.RequestResponsePact; import au.com.dius.pact.core.model.annotations.Pact; import bio.terra.datarepo.model.SnapshotModel; +import java.util.Map; import java.util.UUID; import org.databiosphere.workspacedataservice.datarepo.DataRepoClientFactory; import org.databiosphere.workspacedataservice.datarepo.DataRepoDao; @@ -42,9 +44,9 @@ void setUp() { @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { return builder - .given("snapshot doesn't exist") + .given("snapshot doesn't exist", Map.of("id", dummySnapshotId)) .uponReceiving("a snapshot request") - .path("/api/repository/v1/snapshots/12345678-abc9-012d-3456-e7fab89cd01e") + .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") .method("GET") .willRespondWith() @@ -57,7 +59,7 @@ public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { return builder .given("user does not have access to snapshot") .uponReceiving("a snapshot request") - .path("/api/repository/v1/snapshots/12345678-abc9-012d-3456-e7fab89cd01e") + .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") .method("GET") .willRespondWith() @@ -74,7 +76,7 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build return builder .given("user has access to snapshot") .uponReceiving("a snapshot request") - .path("/api/repository/v1/snapshots/12345678-abc9-012d-3456-e7fab89cd01e") + .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") .method("GET") .willRespondWith() @@ -118,5 +120,6 @@ void testUserHasAccessToSnapshot(MockServer mockServer) { assertNotNull(snapshot, "Snapshot request should return a snapshot"); assertNotNull(snapshot.getId(), "Snapshot response should have an id"); assertNotNull(snapshot.getName(), "Snapshot response should have a name"); + assertEquals(UUID.fromString(dummySnapshotId), snapshot.getId()); } } From 5bd68377f6e3e5cbe7727b895ac12d101391033d Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 11:30:19 -0400 Subject: [PATCH 19/28] Update service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java Co-authored-by: Josh Ladieu <111856+jladieu@users.noreply.github.com> --- .../workspacedataservice/pact/TDRPactTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 684637a18..15e5c2903 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -81,7 +81,11 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build .method("GET") .willRespondWith() .status(200) - .body(snapshotResponseShape) + .body(newJsonBody(snapshot -> { + // toString() only needed if you apply my suggestion to strongly type dummyId + snapshot.stringValue("id", dummySnapshotId.toString()); + snapshot.stringType("name"); + }).build()) .toPact(); } From 13543a6ed4f4213a0a2e82f89fee4017e137f656 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 11:34:09 -0400 Subject: [PATCH 20/28] better variable control --- .../pact/TDRPactTest.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 15e5c2903..123522ddd 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -39,12 +39,12 @@ void setUp() { RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); } - static final String dummySnapshotId = "12345678-abc9-012d-3456-e7fab89cd01e"; + static final UUID dummySnapshotId = UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e"); @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { return builder - .given("snapshot doesn't exist", Map.of("id", dummySnapshotId)) + .given("snapshot with given id doesn't exist", Map.of("id", dummySnapshotId.toString())) .uponReceiving("a snapshot request") .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") @@ -57,10 +57,12 @@ public RequestResponsePact noSnapshotPact(PactDslWithProvider builder) { @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { return builder - .given("user does not have access to snapshot") + .given( + "user does not have access to snapshot with given id", + Map.of("id", dummySnapshotId.toString())) .uponReceiving("a snapshot request") .path("/api/repository/v1/snapshots/" + dummySnapshotId) - .query("include=TABLES") + .matchQuery("include", "TABLES") .method("GET") .willRespondWith() .status(403) @@ -72,20 +74,24 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build // Current use of datarepo snapshot only relies on id and name // Future development should update expected response shape to include fields we need var snapshotResponseShape = - new PactDslJsonBody().stringValue("id", dummySnapshotId).stringType("name"); + new PactDslJsonBody().stringValue("id", dummySnapshotId.toString()).stringType("name"); return builder - .given("user has access to snapshot") + .given( + "user has access to snapshot with given id", Map.of("id", dummySnapshotId.toString())) .uponReceiving("a snapshot request") .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") .method("GET") .willRespondWith() .status(200) - .body(newJsonBody(snapshot -> { - // toString() only needed if you apply my suggestion to strongly type dummyId - snapshot.stringValue("id", dummySnapshotId.toString()); - snapshot.stringType("name"); - }).build()) + .body( + newJsonBody( + snapshot -> { + // toString() only needed if you apply my suggestion to strongly type dummyId + snapshot.stringValue("id", dummySnapshotId.toString()); + snapshot.stringType("name"); + }) + .build()) .toPact(); } @@ -97,7 +103,7 @@ void testNoSnapshot(MockServer mockServer) { assertThrows( DataRepoException.class, - () -> dataRepoDao.getSnapshot(UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e")), + () -> dataRepoDao.getSnapshot(dummySnapshotId), "nonexistent snapshot should return 404"); } @@ -109,7 +115,7 @@ void testNoAccessToSnapshot(MockServer mockServer) { assertThrows( DataRepoException.class, - () -> dataRepoDao.getSnapshot(UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e")), + () -> dataRepoDao.getSnapshot(dummySnapshotId), "nonexistent snapshot should return 403"); } @@ -119,11 +125,10 @@ void testUserHasAccessToSnapshot(MockServer mockServer) { DataRepoClientFactory clientFactory = new HttpDataRepoClientFactory(mockServer.getUrl()); DataRepoDao dataRepoDao = new DataRepoDao(clientFactory); - SnapshotModel snapshot = - dataRepoDao.getSnapshot(UUID.fromString("12345678-abc9-012d-3456-e7fab89cd01e")); + SnapshotModel snapshot = dataRepoDao.getSnapshot(dummySnapshotId); assertNotNull(snapshot, "Snapshot request should return a snapshot"); assertNotNull(snapshot.getId(), "Snapshot response should have an id"); assertNotNull(snapshot.getName(), "Snapshot response should have a name"); - assertEquals(UUID.fromString(dummySnapshotId), snapshot.getId()); + assertEquals(dummySnapshotId, snapshot.getId()); } } From 2fe681b537babe0334a4c90492956aa2032c02fd Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 12:43:31 -0400 Subject: [PATCH 21/28] add import --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 123522ddd..d8473c50a 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -1,5 +1,6 @@ package org.databiosphere.workspacedataservice.pact; +import static au.com.dius.pact.consumer.dsl.LambdaDsl.newJsonBody; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -87,7 +88,6 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build .body( newJsonBody( snapshot -> { - // toString() only needed if you apply my suggestion to strongly type dummyId snapshot.stringValue("id", dummySnapshotId.toString()); snapshot.stringType("name"); }) From 2c2dccddfa029218514954a1a668a077dc498190 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 14:45:52 -0400 Subject: [PATCH 22/28] Update publish-pacts.yml --- .github/workflows/publish-pacts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index d9b1a0dbc..b4ca5eab2 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -73,7 +73,7 @@ jobs: - name: Run consumer tests run: ./gradlew pactTests -- name: Locate all pact json files and output Base64-encoded pacts + - name: Locate all pact json files and output Base64-encoded pacts id: locate-pacts run: | # Locate .json pact files in $pactOutputDir @@ -134,4 +134,4 @@ jobs: "repo-owner": "${{ github.repository_owner }}", "repo-name": "${{ github.event.repository.name }}", "repo-branch": "${{ needs.init-github-context.outputs.repo-branch }}" - }' \ No newline at end of file + }' From b036911e6d4e4467261f7c76bc18e9942fb47bde Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 14:49:41 -0400 Subject: [PATCH 23/28] Update publish-pacts.yml --- .github/workflows/publish-pacts.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index b4ca5eab2..c70446618 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -12,13 +12,9 @@ on: env: WDS_RUN_ID: ${{ github.event.repository.name }}-${{ github.run_id }} - PACTS_OUTPUT_DIR: service/build/pacts/ PUBLISH_CONTRACT_RUN_NAME: 'publish-contracts-${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt }}' - -env: WDS_PACTS_ARTIFACT: wds-pacts-${{ github.event.repository.name }}-${{ github.run_id }} WDS_PACTS_OUTPUT_DIR: service/build/pacts/ - PUBLISH_CONTRACT_RUN_NAME: 'publish-contracts-${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt }}' jobs: init-github-context: @@ -77,7 +73,7 @@ jobs: id: locate-pacts run: | # Locate .json pact files in $pactOutputDir - pactPaths=($(find "${{ env.WDS_PACTS_OUTPUT_DIR }}" -type f -name "*.json")) + pactPaths=($(find "${{ env.WDS_ }}" -type f -name "*.json")) # Put the Base64-encoded pacts in JSON string pactPathsJson="[" @@ -96,7 +92,7 @@ jobs: with: name: ${{ env.WDS_PACTS_ARTIFACT }} path: | - ${{ env.WDS_PACTS_OUTPUT_DIR }} + ${{ env.WDS_ }} retention-days: 1 publish-pacts-job: @@ -112,7 +108,7 @@ jobs: with: name: ${{ env.WDS_PACTS_ARTIFACT }} path: | - ${{ env.WDS_PACTS_OUTPUT_DIR }} + ${{ env.WDS_ }} - name: Encode pact as non-breaking base64 string id: encode-pact From 5abf60ed7a91e95fd3c82ac9013d997fc6d0f747 Mon Sep 17 00:00:00 2001 From: Bria Morgan Date: Thu, 2 Nov 2023 14:56:09 -0400 Subject: [PATCH 24/28] Update publish-pacts.yml --- .github/workflows/publish-pacts.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index c70446618..0aa2595ae 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -73,7 +73,7 @@ jobs: id: locate-pacts run: | # Locate .json pact files in $pactOutputDir - pactPaths=($(find "${{ env.WDS_ }}" -type f -name "*.json")) + pactPaths=($(find "${{ env.WDS_PACTS_OUTPUT_DIR }}" -type f -name "*.json")) # Put the Base64-encoded pacts in JSON string pactPathsJson="[" @@ -92,7 +92,7 @@ jobs: with: name: ${{ env.WDS_PACTS_ARTIFACT }} path: | - ${{ env.WDS_ }} + ${{ env.WDS_PACTS_OUTPUT_DIR }} retention-days: 1 publish-pacts-job: @@ -108,7 +108,7 @@ jobs: with: name: ${{ env.WDS_PACTS_ARTIFACT }} path: | - ${{ env.WDS_ }} + ${{ env.WDS_PACTS_OUTPUT_DIR }} - name: Encode pact as non-breaking base64 string id: encode-pact From 987a183bcfc50d93744cd3e445a8e4953a840da9 Mon Sep 17 00:00:00 2001 From: Josh Ladieu Date: Wed, 8 Nov 2023 10:30:15 -0500 Subject: [PATCH 25/28] Check for tables in TDR response. Followup from: https://github.com/DataBiosphere/terra-workspace-data-service/pull/378/files/b071e41bd0b8d6c72805e51b3c4656393f523e1f#r1385453574 --- .../workspacedataservice/pact/TDRPactTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index d8473c50a..7ca3c5f2b 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -2,6 +2,7 @@ import static au.com.dius.pact.consumer.dsl.LambdaDsl.newJsonBody; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -72,13 +73,14 @@ public RequestResponsePact noAccessToSnapshotPact(PactDslWithProvider builder) { @Pact(consumer = "wds", provider = "datarepo") public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider builder) { - // Current use of datarepo snapshot only relies on id and name - // Future development should update expected response shape to include fields we need var snapshotResponseShape = new PactDslJsonBody().stringValue("id", dummySnapshotId.toString()).stringType("name"); return builder .given( "user has access to snapshot with given id", Map.of("id", dummySnapshotId.toString())) + .given( + "snapshot with given id has at least one table", + Map.of("id", dummySnapshotId.toString())) .uponReceiving("a snapshot request") .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") @@ -90,6 +92,12 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build snapshot -> { snapshot.stringValue("id", dummySnapshotId.toString()); snapshot.stringType("name"); + snapshot.minArrayLike( + "tables", + /* minSize= */ 1, + table -> { + table.stringType("name"); + }); }) .build()) .toPact(); @@ -130,5 +138,9 @@ void testUserHasAccessToSnapshot(MockServer mockServer) { assertNotNull(snapshot.getId(), "Snapshot response should have an id"); assertNotNull(snapshot.getName(), "Snapshot response should have a name"); assertEquals(dummySnapshotId, snapshot.getId()); + + var tables = snapshot.getTables(); + assertFalse(tables.isEmpty()); + tables.forEach(table -> assertNotNull(table.getName())); } } From 7e451128932b628655630d6ec937e5efb7cb5fa9 Mon Sep 17 00:00:00 2001 From: Josh Ladieu Date: Thu, 9 Nov 2023 09:41:38 -0500 Subject: [PATCH 26/28] Remove unneeded `given` specification. TDR snapshot is guaranteed to have at least one table, no need to declare this as part of a given. Context: https://github.com/DataBiosphere/terra-workspace-data-service/pull/378#discussion_r1387310636 --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 7ca3c5f2b..2577e4b60 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -78,9 +78,6 @@ public RequestResponsePact userHasAccessToSnapshotPact(PactDslWithProvider build return builder .given( "user has access to snapshot with given id", Map.of("id", dummySnapshotId.toString())) - .given( - "snapshot with given id has at least one table", - Map.of("id", dummySnapshotId.toString())) .uponReceiving("a snapshot request") .path("/api/repository/v1/snapshots/" + dummySnapshotId) .query("include=TABLES") From d6239895217ce57d1b81bf884953661288127976 Mon Sep 17 00:00:00 2001 From: Josh Ladieu Date: Thu, 9 Nov 2023 09:46:45 -0500 Subject: [PATCH 27/28] Remove temp branch from workflow --- .github/workflows/publish-pacts.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-pacts.yml b/.github/workflows/publish-pacts.yml index 0aa2595ae..0a2859765 100644 --- a/.github/workflows/publish-pacts.yml +++ b/.github/workflows/publish-pacts.yml @@ -7,9 +7,8 @@ on: push: branches: - main - - aj-1188-tdr-consumer paths-ignore: [ '**.md' ] - + env: WDS_RUN_ID: ${{ github.event.repository.name }}-${{ github.run_id }} PUBLISH_CONTRACT_RUN_NAME: 'publish-contracts-${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt }}' @@ -60,7 +59,7 @@ jobs: steps: - name: Checkout current code - uses: actions/checkout@v4 + uses: actions/checkout@v4 - name: Set up JDK uses: actions/setup-java@v2 with: From 4749f4bbfb8b5ba5d03042adb1d7301a04c4d049 Mon Sep 17 00:00:00 2001 From: Josh Ladieu Date: Thu, 9 Nov 2023 09:49:48 -0500 Subject: [PATCH 28/28] Remove redundant assert. Context: https://github.com/DataBiosphere/terra-workspace-data-service/pull/378#discussion_r1385606163 --- .../databiosphere/workspacedataservice/pact/TDRPactTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java index 2577e4b60..c6b51ce66 100644 --- a/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java +++ b/service/src/test/java/org/databiosphere/workspacedataservice/pact/TDRPactTest.java @@ -132,9 +132,8 @@ void testUserHasAccessToSnapshot(MockServer mockServer) { SnapshotModel snapshot = dataRepoDao.getSnapshot(dummySnapshotId); assertNotNull(snapshot, "Snapshot request should return a snapshot"); - assertNotNull(snapshot.getId(), "Snapshot response should have an id"); assertNotNull(snapshot.getName(), "Snapshot response should have a name"); - assertEquals(dummySnapshotId, snapshot.getId()); + assertEquals(dummySnapshotId, snapshot.getId(), "Snapshot id should match the requested id"); var tables = snapshot.getTables(); assertFalse(tables.isEmpty());