Fix region failure-metadata test broken by explicit-region IMDS skip#6105
Merged
Merged
Conversation
PR #6092 stopped calling IMDS for explicitly-configured regions and dropped the region-discovery mocks from the sibling region tests, but missed FailedTokenRequest_SurfacesMetadataOnMsalServiceException_Async (added concurrently in #6096). Its stale AddRegionDiscoveryMockHandler left the IMDS mock first in the queue, so the token POST dequeued it and the URL assertion failed. Remove the stale mock; the region still surfaces via explicit config. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a unit test failure introduced by the change to skip IMDS region discovery when an explicit region is configured. The test was still enqueueing an IMDS region-discovery mock handler, which could be dequeued by the token POST and cause an ExpectedUrl mismatch.
Changes:
- Remove the stale
AddRegionDiscoveryMockHandler(...)fromFailedTokenRequest_SurfacesMetadataOnMsalServiceException_Async, since the test uses an explicitly configured region and should not rely on IMDS. - Preserve the test’s intent: the explicit region still surfaces via
MsalServiceException.AuthenticationResultMetadata.RegionDetails.
RyAuld
approved these changes
Jul 8, 2026
MZOLN
approved these changes
Jul 8, 2026
This was referenced Jul 9, 2026
fix: Bump Microsoft.Identity.Client from 4.85.2 to 4.86.0
Halceyon/open-telemetry-trace-listener#213
Closed
Merged
Merged
Closed
Closed
This was referenced Jul 12, 2026
Merged
Open
Merged
Closed
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.
FailedTokenRequest_SurfacesMetadataOnMsalServiceException_Async(added in #6096) fails on main. #6092 stopped calling IMDS for explicitly-configured regions and removed the region-discovery mocks from the sibling region tests, but this one was landing at the same time and got missed.Its stale
AddRegionDiscoveryMockHandlerleft the IMDS mock first in the queue, so the token POST dequeued it and the URL assertion failed (expected169.254.169.254.../ actual.../login.microsoft.com/.../token).Removes the stale mock — the region still surfaces via explicit config. Test + the full region suite (45) pass locally.