Fix storage service-version gates for all-version tests - #50294
Open
browndav-msft wants to merge 1 commit into
Open
Fix storage service-version gates for all-version tests#50294browndav-msft wants to merge 1 commit into
browndav-msft wants to merge 1 commit into
Conversation
The all-versions matrix configures AZURE_LIVE_TEST_SERVICE_VERSION using enum names such as V2021_06_08, while @RequiredServiceVersion uses wire values. For example, QueueServiceAsyncApiTests requires "2026-02-06". The gate compared both values using Enum.toString(), so "2026-02-06" was unresolved and returned ordinal -1. As a result, the 2026-only test ran against the 2021 service version instead of being skipped. Resolve enum names and wire values explicitly, and reject unknown versions rather than failing open.
browndav-msft
requested review from
a team,
Alan Zimmer (alzimmermsft),
gunjansingh-msft,
Isabelle (ibrandes),
Kyle Knapp (kyleknap) and
Sean McCullough (seanmcc-msft)
as code owners
August 29, 2026 18:09
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the Storage test gating logic in RequiredServiceVersionExtension so that minimum required service versions declared as wire values (e.g., "2026-02-06") are correctly compared against configured versions that may be provided as enum names (e.g., V2021_06_08) in all-version test matrix runs.
Changes:
- Correctly resolve service versions by matching either
ServiceVersion.getVersion()(wire value) orEnum.name()(enum name), rather than relying ontoString(). - Fail closed by throwing a descriptive
IllegalArgumentExceptionwhen configured or minimum versions are unknown, instead of returning-1and potentially enabling tests incorrectly. - Add focused unit tests for ordering comparisons, latest-version fallback behavior, and unknown-version validation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/storage/azure-storage-common/src/test-shared/java/com/azure/storage/common/test/shared/extensions/RequiredServiceVersionExtension.java | Fixes version resolution and comparison logic; adds injectable overload and throws on unknown versions. |
| sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/test/shared/extensions/RequiredServiceVersionExtensionTests.java | Adds unit coverage validating correct skip behavior across wire values, enum names, fallback, and unknown inputs. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
RequiredServiceVersionExtensionreceives service versions in two different string representations:AZURE_LIVE_TEST_SERVICE_VERSIONto an enum name such asV2021_06_08.@RequiredServiceVersionannotations use the service wire value, such as"2026-02-06".For example,
QueueServiceAsyncApiTests.queueServiceGetUserDelegationKey, which requires"2026-02-06", whileplatform-matrix-all-versions.jsonincludes runs configured withV2021_06_08.The extension previously resolved both inputs by comparing them with
String.valueOf(serviceVersion). Storage service-version enums do not overrideEnum.toString(), so that expression produces the enum name (V2026_02_06) rather than the wire value (2026-02-06).Consequently, the required wire value could not be found and received ordinal
-1even though the value actual exists (see screenshots below):The extension therefore enabled a test requiring service version
2026-02-06during aV2021_06_08matrix run instead of skipping it. Unknown versions also returned-1, allowing malformed annotations or configuration to fail open in the same way.Fix
ServiceVersion.getVersion()) or its exact enum name (Enum.name()).-1.This does not change how
x-ms-versionis sent to Storage. The test infrastructure still converts the configured enum name to aServiceVersion, and the client sends that enum'sgetVersion()value over the wire.Testing
Added focused unit coverage for:
Validated with the focused
RequiredServiceVersionExtensionTests, Spotless, and Checkstyle. The Maven test compilation covered both Java 8 and Java 21.All SDK Contribution checklist
General Guidelines and Best Practices
Testing Guidelines