-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Allow extra Azurite command line options #11970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| package org.testcontainers.azure; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| import org.junit.jupiter.api.Test; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import org.testcontainers.utility.MountableFile; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| class AzuriteContainerCommandTest { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| private static final String IMAGE = "mcr.microsoft.com/azure-storage/azurite:3.33.0"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||
| void commandLineOmitsExtraOptionsByDefault() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| AzuriteContainer emulator = new AzuriteContainer(IMAGE); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| assertThat(emulator.getCommandLine()).doesNotContain("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||
| void commandLineIncludesExtraOptions() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| // commandOptions { | ||||||||||||||||||||||||||||||||||||||||||||||||
| AzuriteContainer emulator = new AzuriteContainer(IMAGE).withCommandOptions("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| assertThat(emulator.getCommandLine()) | ||||||||||||||||||||||||||||||||||||||||||||||||
| .startsWith("azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0") | ||||||||||||||||||||||||||||||||||||||||||||||||
| .contains("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||
| void commandLineAppendsMultipleOptions() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| AzuriteContainer emulator = new AzuriteContainer(IMAGE) | ||||||||||||||||||||||||||||||||||||||||||||||||
| .withCommandOptions("--skipApiVersionCheck", "--disableProductStyleUrl"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| assertThat(emulator.getCommandLine()).contains("--skipApiVersionCheck").contains("--disableProductStyleUrl"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||
| void commandLineKeepsExtraOptionsTogetherWithSsl() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| AzuriteContainer emulator = new AzuriteContainer(IMAGE) | ||||||||||||||||||||||||||||||||||||||||||||||||
| .withSsl(MountableFile.forClasspathResource("/keystore.pfx"), "changeit") | ||||||||||||||||||||||||||||||||||||||||||||||||
| .withCommandOptions("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| assertThat(emulator.getCommandLine()) | ||||||||||||||||||||||||||||||||||||||||||||||||
| .contains("--cert /cert.pfx") | ||||||||||||||||||||||||||||||||||||||||||||||||
| .contains("--pwd changeit") | ||||||||||||||||||||||||||||||||||||||||||||||||
| .contains("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||
| void configureAppliesCommandOptionsEvenIfWithCommandWasUsed() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| AzuriteContainer emulator = new AzuriteContainer(IMAGE) | ||||||||||||||||||||||||||||||||||||||||||||||||
| .withCommand("azurite --skipApiVersionCheck") | ||||||||||||||||||||||||||||||||||||||||||||||||
| .withCommandOptions("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| emulator.configure(); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| assertThat(String.join(" ", emulator.getCommandParts())).contains("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| assertThat(emulator.getCommandLine()).contains("--blobHost 0.0.0.0").contains("--skipApiVersionCheck"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Make the custom-command test prove that
Suggested test change- .withCommand("azurite --skipApiVersionCheck")
+ .withCommand("azurite --ignored")
...
- assertThat(String.join(" ", emulator.getCommandParts())).contains("--skipApiVersionCheck");
+ assertThat(String.join(" ", emulator.getCommandParts()))
+ .isEqualTo(
+ "azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --skipApiVersionCheck"
+ );📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert option ordering, not only presence.
These assertions pass if options are reordered or placed before the SSL arguments. Assert the expected command suffix so the tests verify the documented append order.
Suggested assertions
assertThat(emulator.getCommandLine()).contains("--skipApiVersionCheck").contains("--disableProductStyleUrl"); + assertThat(emulator.getCommandLine()).endsWith("--skipApiVersionCheck --disableProductStyleUrl"); ... .contains("--pwd changeit") - .contains("--skipApiVersionCheck"); + .contains("--skipApiVersionCheck") + .endsWith("--pwd changeit --skipApiVersionCheck");Also applies to: 38-47
🤖 Prompt for AI Agents