Allow skip version check to be set with env var#2628
Allow skip version check to be set with env var#2628HerrDerb wants to merge 3 commits intoAzure:mainfrom
Conversation
d5802f6 to
215176b
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for enabling Azurite’s --skipApiVersionCheck behavior via an environment variable, primarily to simplify container/testcontainer usage.
Changes:
- Add
AZURITE_SKIP_API_VERSION_CHECK=truesupport to enableskipApiVersionCheckin the combinedazuriteentrypoint environment parsing. - Add a new unit test file covering default behavior, env-var behavior, and CLI-flag behavior.
- Document the new env var support in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/common/Environment.ts |
Extends skipApiVersionCheck() to return true when AZURITE_SKIP_API_VERSION_CHECK is set to "true". |
tests/common/environment.test.ts |
Adds tests for env var and CLI flag behavior around skipApiVersionCheck(). |
ChangeLog.md |
Notes the new env var support under “Upcoming Release”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring skipApiVersionCheck via the AZURITE_SKIP_API_VERSION_CHECK=true environment variable, making it easier to disable API version enforcement in containerized/testcontainer scenarios (per issue #2626).
Changes:
- Introduces a shared
shouldSkipApiVersionCheck()helper that checks both CLI flags andAZURITE_SKIP_API_VERSION_CHECK. - Updates Blob/Queue/Table and the common
Environmentto use the shared helper. - Adds new unit tests for the env-var behavior and updates the changelog.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/blob/blobEnvironment.test.ts | Adds coverage for env-var-driven skipApiVersionCheck() behavior in BlobEnvironment. |
| tests/queue/queueEnvironment.test.ts | Adds coverage for env-var-driven skipApiVersionCheck() behavior in QueueEnvironment. |
| tests/table/tableEnvironment.test.ts | Adds coverage for env-var-driven skipApiVersionCheck() behavior in TableEnvironment. |
| tests/common/environment.test.ts | Adds tests for the common Environment behavior (but currently not run by CI scripts). |
| src/blob/BlobEnvironment.ts | Delegates skipApiVersionCheck() logic to the shared helper. |
| src/queue/QueueEnvironment.ts | Delegates skipApiVersionCheck() logic to the shared helper. |
| src/table/TableEnvironment.ts | Delegates skipApiVersionCheck() logic to the shared helper; includes minor formatting changes. |
| src/common/Environment.ts | Delegates skipApiVersionCheck() logic to the shared helper for the azurite CLI. |
| src/common/utils/utils.ts | Adds shouldSkipApiVersionCheck() helper reading CLI flags + env var. |
| ChangeLog.md | Documents the new env var support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| describe("Environment", () => { | ||
| const originalArgv = process.argv; | ||
|
|
||
| beforeEach(() => { | ||
| process.argv = ["node", "azurite"]; | ||
| delete process.env.AZURITE_SKIP_API_VERSION_CHECK; | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| process.argv = originalArgv; | ||
| delete process.env.AZURITE_SKIP_API_VERSION_CHECK; | ||
| }); |
| /** | ||
| * Shared helper to determine whether API version checks should be skipped. | ||
| * This checks both CLI flags and the AZURITE_SKIP_API_VERSION_CHECK env var. | ||
| */ | ||
| export function shouldSkipApiVersionCheck(flags: any): boolean { | ||
| if (flags && flags.skipApiVersionCheck !== undefined) { | ||
| return true; | ||
| } | ||
| if (process.env.AZURITE_SKIP_API_VERSION_CHECK === "true") { | ||
| return true; | ||
| } |
| - Performance improvements for internal metadata access using in-memory metadata store | ||
| - Fix building failure on Node 22 platform. | ||
| - Fix * IfMatch for non-existent resource not throwing 412 Precondition Failed | ||
| - Allow setting `--skipApiVersionCheck` via the `AZURITE_SKIP_API_VERSION_CHECK=true` environment variable |
Allow to set
skipApiVersionCheckflag with env varAZURITE_SKIP_API_VERSION_CHECK=trueThis allows to deactivate the
skipApiVersionCheckin an easy way when running in a container such as a testcontainer.Resolves #2626