From 7c79d57115a7b7a86cacdf8dc8fbacedf501d933 Mon Sep 17 00:00:00 2001 From: Ruth Bovell Date: Thu, 7 Nov 2024 11:15:16 +0000 Subject: [PATCH] FACT-2003 - updates azure storage blob version (#3363) * - updates azure-storage-blob * - updates building azurite image with skipping azure storage blob version * - removes unneeded docker compose file * - updates test to reflect new version of azure * - updates test to reflect new version of azure * - updates test to reflect new version of azure --- build.gradle | 2 +- .../bulkscanprocessor/controllers/GetSasTokenTest.java | 2 +- .../controllers/EnvelopeControllerTest.java | 3 ++- .../controllers/SasTokenControllerTest.java | 2 +- .../controllers/ZipStatusControllerTest.java | 3 ++- .../services/reports/RejectedFilesReportServiceTest.java | 3 ++- .../services/storage/OcrValidationRetryManagerTest.java | 3 ++- .../tasks/CleanUpRejectedFilesTaskTest.java | 3 ++- .../bulkscanprocessor/tasks/ProcessorTestSuite.java | 3 ++- .../reform/bulkscanprocessor/util/TestStorageHelper.java | 3 ++- src/integrationTest/resources/docker-compose.yml | 8 -------- .../services/SasTokenGeneratorServiceTest.java | 2 +- .../tasks/processor/BlobManagerTest.java | 4 +++- 13 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 src/integrationTest/resources/docker-compose.yml diff --git a/build.gradle b/build.gradle index 12d5c6caaa..121d21a8a4 100644 --- a/build.gradle +++ b/build.gradle @@ -276,7 +276,7 @@ dependencies { implementation group: 'net.javacrumbs.shedlock', name: 'shedlock-spring', version: '5.14.0' implementation group: 'net.javacrumbs.shedlock', name: 'shedlock-provider-jdbc', version: '5.14.0' - implementation group: 'com.azure', name: 'azure-storage-blob', version: '12.25.4' + implementation group: 'com.azure', name: 'azure-storage-blob', version: '12.28.1' implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.17.5' diff --git a/src/functionalTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/GetSasTokenTest.java b/src/functionalTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/GetSasTokenTest.java index 8afa98e579..9c5523d602 100644 --- a/src/functionalTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/GetSasTokenTest.java +++ b/src/functionalTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/GetSasTokenTest.java @@ -137,7 +137,7 @@ private void verifySasTokenProperties(Response tokenResponse) throws java.io.IOE Date tokenExpiry = DateUtil.parseDatetime(queryParams.get("se")); assertThat(tokenExpiry).isNotNull(); assertThat(queryParams.get("sig")).isNotNull(); //this is a generated hash of the resource string - assertThat(queryParams.get("sv")).contains("2023-11-03"); //azure api version is latest + assertThat(queryParams.get("sv")).contains("2024-11-04"); //azure api version is latest assertThat(queryParams.get("sp")).contains("wl"); //access permissions(write-w,list-l) } diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/EnvelopeControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/EnvelopeControllerTest.java index 849982a1dd..b9c7717f14 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/EnvelopeControllerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/EnvelopeControllerTest.java @@ -114,7 +114,8 @@ public class EnvelopeControllerTest { private BlobContainerClient testContainer; private static GenericContainer dockerComposeContainer = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private static String dockerHost; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/SasTokenControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/SasTokenControllerTest.java index c635381b1d..083d909e92 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/SasTokenControllerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/SasTokenControllerTest.java @@ -67,7 +67,7 @@ private void verifySasTokenProperties(String tokenResponse) throws java.io.IOExc assertThat(queryParams.get("sig")).isNotNull();//this is a generated hash of the resource string assertThat(queryParams.get("se")).startsWith(currentDate);//the expiry date/time for the signature - assertThat(queryParams.get("sv")).contains("2023-11-03");//azure api version is latest + assertThat(queryParams.get("sv")).contains("2024-11-04");//azure api version is latest assertThat(queryParams.get("sp")).contains("wl");//access permissions(write-w,list-l) } } diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/ZipStatusControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/ZipStatusControllerTest.java index caa8d5b3e8..6624671a51 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/ZipStatusControllerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/controllers/ZipStatusControllerTest.java @@ -105,7 +105,8 @@ class ZipStatusControllerTest { private static GenericContainer dockerComposeContainer = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private static String dockerHost; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/reports/RejectedFilesReportServiceTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/reports/RejectedFilesReportServiceTest.java index 93e3116f63..28f3ae803d 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/reports/RejectedFilesReportServiceTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/reports/RejectedFilesReportServiceTest.java @@ -31,7 +31,8 @@ public class RejectedFilesReportServiceTest { private BlobManager blobManager; private static GenericContainer dockerComposeContainer = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private static String dockerHost; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/storage/OcrValidationRetryManagerTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/storage/OcrValidationRetryManagerTest.java index 9a036b107c..1fd91b8a05 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/storage/OcrValidationRetryManagerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/services/storage/OcrValidationRetryManagerTest.java @@ -34,7 +34,8 @@ class OcrValidationRetryManagerTest { private OcrValidationRetryManager ocrValidationRetryManager; private static GenericContainer dockerComposeContainer = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private static String dockerHost; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/CleanUpRejectedFilesTaskTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/CleanUpRejectedFilesTaskTest.java index 89c8f80d1b..b5c6d6df1e 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/CleanUpRejectedFilesTaskTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/CleanUpRejectedFilesTaskTest.java @@ -47,7 +47,8 @@ public class CleanUpRejectedFilesTaskTest { private BlobManager blobManager; private static GenericContainer dockerComposeContainer = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private static String dockerHost; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/ProcessorTestSuite.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/ProcessorTestSuite.java index 53457762da..8db8c8d19a 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/ProcessorTestSuite.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/ProcessorTestSuite.java @@ -127,7 +127,8 @@ public abstract class ProcessorTestSuite { protected BlobContainerClient rejectedContainer; private static GenericContainer dockerComposeContainer = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private static String dockerHost; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/util/TestStorageHelper.java b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/util/TestStorageHelper.java index 8f46ac2f71..44d8389ced 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/util/TestStorageHelper.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/util/TestStorageHelper.java @@ -26,7 +26,8 @@ public class TestStorageHelper { private BlobContainerClient testContainer; private static GenericContainer DOCKER_COMPOSE_CONTAINER = - new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT); + new GenericContainer<>(AZURE_TEST_CONTAINER).withExposedPorts(CONTAINER_PORT) + .withCommand("azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --skipApiVersionCheck"); private TestStorageHelper() { // empty constructor diff --git a/src/integrationTest/resources/docker-compose.yml b/src/integrationTest/resources/docker-compose.yml deleted file mode 100644 index d418c3c127..0000000000 --- a/src/integrationTest/resources/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: '3' -services: - azure-storage: - image: mcr.microsoft.com/azure-storage/azurite:3.29.0 - ports: - - 10000:10000 - environment: - - executable=blob diff --git a/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/services/SasTokenGeneratorServiceTest.java b/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/services/SasTokenGeneratorServiceTest.java index 819384be04..90811488cc 100644 --- a/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/services/SasTokenGeneratorServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/services/SasTokenGeneratorServiceTest.java @@ -60,7 +60,7 @@ void should_generate_sas_token_when_service_configuration_is_available() { assertThat(queryParams.get("sig")).isNotNull();//this is a generated hash of the resource string assertThat(queryParams.get("se")).startsWith(currentDate);//the expiry date/time for the signature - assertThat(queryParams.get("sv")).contains("2023-11-03");//azure api version is latest + assertThat(queryParams.get("sv")).contains("2024-11-04");//azure api version is latest assertThat(queryParams.get("sp")).contains("rwl");//access permissions(write-w,list-l) } diff --git a/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/processor/BlobManagerTest.java b/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/processor/BlobManagerTest.java index 6e7177d3ed..432306981f 100644 --- a/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/processor/BlobManagerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/processor/BlobManagerTest.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.bulkscanprocessor.tasks.processor; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; @@ -201,7 +202,8 @@ void tryMoveFileToRejectedContainer_retry_delete_when_lease_lost() { given(response.getStatusCode()).willReturn(412); HttpHeaders httpHeaders = mock(HttpHeaders.class); given(response.getHeaders()).willReturn(httpHeaders); - given(httpHeaders.getValue(ERROR_CODE)).willReturn(BlobErrorCode.LEASE_LOST.toString()); + given(httpHeaders.getValue(HttpHeaderName.fromString(ERROR_CODE))) + .willReturn(String.valueOf(BlobErrorCode.LEASE_LOST)); willThrow(new BlobStorageException(BlobErrorCode.LEASE_LOST.toString(), response, null))