From 47080968c7c451651c3bb50cc706ce71311b445c Mon Sep 17 00:00:00 2001 From: Sean-DNAstack Date: Fri, 27 Oct 2023 15:48:44 -0400 Subject: [PATCH] Fix failing e2e tests --- .../com/dnastack/wes/service/WesE2ETest.java | 46 +++++++++---------- .../com/dnastack/wes/api/WesV1Controller.java | 4 +- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/e2e-tests/src/main/java/com/dnastack/wes/service/WesE2ETest.java b/e2e-tests/src/main/java/com/dnastack/wes/service/WesE2ETest.java index b0e9eeb..95f8c26 100644 --- a/e2e-tests/src/main/java/com/dnastack/wes/service/WesE2ETest.java +++ b/e2e-tests/src/main/java/com/dnastack/wes/service/WesE2ETest.java @@ -583,10 +583,10 @@ public void getRunFilesReturnsNonEmptyCollection(String runId) { given() .log().uri() .log().method() - .header(getHeader(getResource(getRootPath() + "/runs/" + runId))) + .header(getHeader(getResource(path))) .accept(ContentType.JSON) - .get(path) - .then() + .get(path) + .then() .assertThat() .statusCode(200) .body("runFiles.size()", greaterThan(0)) @@ -598,17 +598,16 @@ public void getRunFilesReturnsNonEmptyCollection(String runId) { @Test @DisplayName("Get Run Files for non-existent run fails with status 401 or 404") public void getRunFilesForNonExistentRunShouldFail() { - String resourcePath = getRootPath() + "/runs/" + UUID.randomUUID(); - String path = resourcePath + "/files"; + String path = getRootPath() + "/runs/" + UUID.randomUUID() + "/files"; //@formatter:off given() .log().uri() .log().method() - .header(getHeader(getResource(resourcePath))) + .header(getHeader(getResource(path))) .accept(ContentType.JSON) - .get(path) - .then() + .get(path) + .then() .assertThat() .statusCode(anyOf(equalTo(404), equalTo(401))); //@formatter:on @@ -625,10 +624,10 @@ public void deleteRunFilesReturnsNonEmptyCollection(String runId) { given() .log().uri() .log().method() - .header(getHeader(getResource(getRootPath() + "/runs/" + runId))) + .header(getHeader(getResource(path))) .accept(ContentType.JSON) - .delete(path) - .then() + .delete(path) + .then() .assertThat() .statusCode(200) .body("deletions.size()", greaterThan(0)) @@ -647,11 +646,11 @@ public void deleteRunFilesAsyncReturnsNonEmptyCollection(String runId) { given() .log().uri() .log().method() - .header(getHeader(getResource(getRootPath() + "/runs/" + runId))) + .header(getHeader(getResource(path))) .accept(ContentType.JSON) .queryParam("async", true) - .delete(path) - .then() + .delete(path) + .then() .assertThat() .statusCode(200) .body("deletions.size()", greaterThan(0)) @@ -666,10 +665,10 @@ public void deleteRunFilesAsyncReturnsNonEmptyCollection(String runId) { given() .log().uri() .log().method() - .header(getHeader(getResource(getRootPath() + "/runs/" + runId))) + .header(getHeader(getResource(path))) .accept(ContentType.JSON) - .get(path) - .then() + .get(path) + .then() .assertThat() .statusCode(200) .body("runFiles.size()", greaterThan(0)) @@ -681,17 +680,16 @@ public void deleteRunFilesAsyncReturnsNonEmptyCollection(String runId) { @Test @DisplayName("Delete Run Files for non-existent run fails with status 401 or 404") public void deleteRunFilesForNonExistentRunShouldFail() { - String resourcePath = getRootPath() + "/runs/" + UUID.randomUUID(); - String path = resourcePath + "/files"; + String path = getRootPath() + "/runs/" + UUID.randomUUID() + "/files"; //@formatter:off given() .log().uri() .log().method() - .header(getHeader(getResource(resourcePath))) + .header(getHeader(getResource(path))) .accept(ContentType.JSON) - .delete(path) - .then() + .delete(path) + .then() .assertThat() .statusCode(anyOf(equalTo(404),equalTo(401))); //@formatter:on @@ -710,8 +708,8 @@ private Stream completeWorkflowWithFilesProvider() throws Exception { .multiPart(getWorkflowUrlMultipart("echo.wdl")) .multiPart(getMultipartAttachment("echo.wdl", supplier.getFileContent(WdlSupplier.WORKFLOW_WITH_ALL_OUTPUT_TYPES).getBytes())) .multiPart(getJsonMultipart("workflow_params", inputs)) - .post(path) - .then() + .post(path) + .then() .assertThat() .statusCode(200) .body("run_id", is(notNullValue())) diff --git a/src/main/java/com/dnastack/wes/api/WesV1Controller.java b/src/main/java/com/dnastack/wes/api/WesV1Controller.java index 541da8e..044c505 100644 --- a/src/main/java/com/dnastack/wes/api/WesV1Controller.java +++ b/src/main/java/com/dnastack/wes/api/WesV1Controller.java @@ -103,14 +103,14 @@ public RunListResponse getRuns( } @AuditActionUri("wes:run:read") - @PreAuthorize("@accessEvaluator.canAccessResource('/ga4gh/wes/v1/runs/'+#runId, 'wes:runs:read', 'wes')") + @PreAuthorize("@accessEvaluator.canAccessResource('/ga4gh/wes/v1/runs/' + #runId, 'wes:runs:read', 'wes')") @GetMapping(value = "/runs/{run_id}", produces = { MediaType.APPLICATION_JSON_VALUE }) public RunLog getRun(@PathVariable("run_id") String runId) { return adapter.getRun(runId); } @AuditActionUri("wes:run:status") - @PreAuthorize("@accessEvaluator.canAccessResource('/ga4gh/wes/v1/runs/' + #runId , 'wes:runs:read', 'wes')") + @PreAuthorize("@accessEvaluator.canAccessResource('/ga4gh/wes/v1/runs/' + #runId, 'wes:runs:read', 'wes')") @GetMapping(value = "/runs/{run_id}/status", produces = { MediaType.APPLICATION_JSON_VALUE }) public RunStatus getRunStatus(@PathVariable("run_id") String runId) { return adapter.getRunStatus(runId);