Skip to content

Fix region failure-metadata test broken by explicit-region IMDS skip#6105

Merged
neha-bhargava merged 1 commit into
mainfrom
nebharg/fix-region-failure-metadata-test
Jul 8, 2026
Merged

Fix region failure-metadata test broken by explicit-region IMDS skip#6105
neha-bhargava merged 1 commit into
mainfrom
nebharg/fix-region-failure-metadata-test

Conversation

@neha-bhargava

Copy link
Copy Markdown
Contributor

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 AddRegionDiscoveryMockHandler left the IMDS mock first in the queue, so the token POST dequeued it and the URL assertion failed (expected 169.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.

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>
Copilot AI review requested due to automatic review settings July 8, 2026 20:18
@neha-bhargava
neha-bhargava requested a review from a team as a code owner July 8, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(...) from FailedTokenRequest_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.

@neha-bhargava
neha-bhargava merged commit daeb6cc into main Jul 8, 2026
16 checks passed
@neha-bhargava
neha-bhargava deleted the nebharg/fix-region-failure-metadata-test branch July 8, 2026 21:23
This was referenced Jul 9, 2026
This was referenced Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants