From 1b0a984632124ae58d0f803d71eda03ebf0a0732 Mon Sep 17 00:00:00 2001 From: fdambrine Date: Mon, 8 Jun 2026 08:59:42 +0200 Subject: [PATCH] Add helper to ignore check version on azurite container --- .../azure/AzuriteContainer.java | 19 ++++++++++++++++++ .../azure/AzuriteContainerTest.java | 20 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/modules/azure/src/main/java/org/testcontainers/azure/AzuriteContainer.java b/modules/azure/src/main/java/org/testcontainers/azure/AzuriteContainer.java index 56c58df1f1d..774f2b6a3f3 100644 --- a/modules/azure/src/main/java/org/testcontainers/azure/AzuriteContainer.java +++ b/modules/azure/src/main/java/org/testcontainers/azure/AzuriteContainer.java @@ -51,6 +51,7 @@ public class AzuriteContainer extends GenericContainer { private MountableFile key = null; private String pwd = null; + private boolean ignoreApiVersionCheck = false; /** * @param dockerImageName specified docker image name to run @@ -82,6 +83,7 @@ public AzuriteContainer withSsl(final MountableFile pfxCert, final String passwo return this; } + /** * Configure SSL with a custom certificate and private key. * @@ -96,6 +98,20 @@ public AzuriteContainer withSsl(final MountableFile pemCert, final MountableFile return this; } + + /** + * Configure the container to ignore version checks. + * This is useful as Azure SDK update are more frequent than Azurite releases. + * + * @param ignore true to ignore version checks, false otherwise, default is false + * @return this + */ + public AzuriteContainer withIgnoreApiVersionCheck(boolean ignore) { + this.ignoreApiVersionCheck = ignore; + return this; + } + + @Override protected void configure() { withCommand(getCommandLine()); @@ -152,6 +168,9 @@ String getCommandLine() { args.append(" --blobHost ").append(ALLOW_ALL_CONNECTIONS); args.append(" --queueHost ").append(ALLOW_ALL_CONNECTIONS); args.append(" --tableHost ").append(ALLOW_ALL_CONNECTIONS); + if (this.ignoreApiVersionCheck) { + args.append(" --skipApiVersionCheck"); + } if (this.cert != null) { args.append(" --cert ").append("/cert").append(this.certExtension); if (this.pwd != null) { diff --git a/modules/azure/src/test/java/org/testcontainers/azure/AzuriteContainerTest.java b/modules/azure/src/test/java/org/testcontainers/azure/AzuriteContainerTest.java index 5acf2fe5ad5..8332971f5d0 100644 --- a/modules/azure/src/test/java/org/testcontainers/azure/AzuriteContainerTest.java +++ b/modules/azure/src/test/java/org/testcontainers/azure/AzuriteContainerTest.java @@ -154,6 +154,26 @@ void testWithTableServiceClientWithSslUsingPem() { } } + @Test + void testWithIgnoreApiVersionCheckAloneAndWithSsl() { + AzuriteContainer withoutSsl = new AzuriteContainer("mcr.microsoft.com/azure-storage/azurite:3.33.0") + .withIgnoreApiVersionCheck(true); + + assertThat(withoutSsl.getCommandLine()) + .contains("--skipApiVersionCheck") + .doesNotContain("--cert") + .doesNotContain("--key"); + + AzuriteContainer withSsl = new AzuriteContainer("mcr.microsoft.com/azure-storage/azurite:3.33.0") + .withIgnoreApiVersionCheck(true) + .withSsl(MountableFile.forClasspathResource("/keystore.pfx"), PASSWORD); + + assertThat(withSsl.getCommandLine()) + .contains("--skipApiVersionCheck") + .contains("--cert /cert.pfx") + .contains("--pwd " + PASSWORD); + } + @Test void testTwoAccountKeysWithBlobServiceClient() { try (