From eaf883acb43a5f8af73f90e0ef62f2f3394e2b69 Mon Sep 17 00:00:00 2001 From: Neha Bhargava Date: Wed, 8 Jul 2026 13:18:29 -0700 Subject: [PATCH] Fix FailedTokenRequest metadata test broken by explicit-region IMDS skip 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> --- .../PublicApiTests/ClientCredentialWithRegionTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Microsoft.Identity.Test.Unit/PublicApiTests/ClientCredentialWithRegionTests.cs b/tests/Microsoft.Identity.Test.Unit/PublicApiTests/ClientCredentialWithRegionTests.cs index fe7a510239..1b88f55679 100644 --- a/tests/Microsoft.Identity.Test.Unit/PublicApiTests/ClientCredentialWithRegionTests.cs +++ b/tests/Microsoft.Identity.Test.Unit/PublicApiTests/ClientCredentialWithRegionTests.cs @@ -595,7 +595,6 @@ public async Task FailedTokenRequest_SurfacesMetadataOnMsalServiceException_Asyn using (var harness = base.CreateTestHarness()) { var httpManager = harness.HttpManager; - httpManager.AddRegionDiscoveryMockHandler(TestConstants.Region); httpManager.AddMockHandler(new MockHttpMessageHandler() { ExpectedUrl = $"https://{TestConstants.Region}.login.microsoft.com/common/oauth2/v2.0/token",