Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/modules/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ Start Azurite Emulator during a test:
!!! note
SSL configuration is possible using the `withSsl(MountableFile, String)` and `withSsl(MountableFile, MountableFile)` methods.

!!! note
The Azure SDK evolves faster than the Azurite image in some cases. If your client fails to connect with an error such as
`The API version {{version}} is not supported by Azurite. Please upgrade Azurite to latest version and retry.`,
you can disable the version check with `withSkipApiVersionCheck()`.

Example:

```java
AzuriteContainer azurite = new AzuriteContainer("mcr.microsoft.com/azure-storage/azurite:latest")
.withSkipApiVersionCheck();
```

If the tested application needs to use more than one set of credentials, the container can be configured to use custom credentials.
Please see some examples below.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class AzuriteContainer extends GenericContainer<AzuriteContainer> {
private MountableFile key = null;

private String pwd = null;
private boolean skipApiVersionCheck = false;

/**
* @param dockerImageName specified docker image name to run
Expand Down Expand Up @@ -96,6 +97,17 @@ public AzuriteContainer withSsl(final MountableFile pemCert, final MountableFile
return this;
}

/**
* Configure the container to skip version checks.
* This is useful as Azure SDK update are more frequent than Azurite releases.
*
* @return this
*/
public AzuriteContainer withSkipApiVersionCheck() {
this.skipApiVersionCheck = true;
return this;
}

@Override
protected void configure() {
withCommand(getCommandLine());
Expand Down Expand Up @@ -152,6 +164,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.skipApiVersionCheck) {
args.append(" --skipApiVersionCheck");
}
if (this.cert != null) {
args.append(" --cert ").append("/cert").append(this.certExtension);
if (this.pwd != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,35 @@ void testWithTableServiceClientWithSslUsingPem() {
}
}

@Test
void testWithIgnoreApiVersionCheckAlone() {
AzuriteContainer withoutSsl = new AzuriteContainer("mcr.microsoft.com/azure-storage/azurite:3.33.0")
.withSkipApiVersionCheck();

assertThat(withoutSsl.getCommandLine())
.contains("--skipApiVersionCheck")
.doesNotContain("--cert")
.doesNotContain("--key");
}

@Test
void testWithIgnoreApiVersionCheckWithSsl() {
AzuriteContainer withSsl = new AzuriteContainer("mcr.microsoft.com/azure-storage/azurite:3.33.0")
.withSkipApiVersionCheck()
.withSsl(MountableFile.forClasspathResource("/keystore.pfx"), PASSWORD);

assertThat(withSsl.getCommandLine())
.contains("--skipApiVersionCheck")
.contains("--cert /cert.pfx")
.contains("--pwd " + PASSWORD);
}

@Test
void testDefaultCommandLineDoesNotContainSkipApiVersionCheck() {
AzuriteContainer container = new AzuriteContainer("mcr.microsoft.com/azure-storage/azurite:3.33.0");
assertThat(container.getCommandLine()).doesNotContain("--skipApiVersionCheck");
}

@Test
void testTwoAccountKeysWithBlobServiceClient() {
try (
Expand Down