Skip to content

Commit

Permalink
FACT-2003 - updates azure storage blob version (#3363)
Browse files Browse the repository at this point in the history
* - 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
  • Loading branch information
RuthKirby authored Nov 7, 2024
1 parent 6cc5fb3 commit 7c79d57
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/integrationTest/resources/docker-compose.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 7c79d57

Please sign in to comment.