Skip to content

Commit

Permalink
Fix tests (#4148)
Browse files Browse the repository at this point in the history
  • Loading branch information
neha-bhargava authored May 23, 2023
1 parent 8c5d47a commit e661354
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ public async Task AppServiceInvalidEndpointAsync()
{
SetEnvironmentVariables(ManagedIdentitySource.AppService, "127.0.0.1:41564/msi/token");

IManagedIdentityApplication mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
.WithHttpManager(httpManager)
.Build();
var miBuilder = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
.WithHttpManager(httpManager);

// Disabling shared cache options to avoid cross test pollution.
miBuilder.Config.AccessorOptions = null;

var mi = miBuilder.Build();

MsalManagedIdentityException ex = await Assert.ThrowsExceptionAsync<MsalManagedIdentityException>(async () =>
await mi.AcquireTokenForManagedIdentity(ManagedIdentityTests.Resource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ public async Task AzureArcInvalidEndpointAsync()
{
SetEnvironmentVariables(ManagedIdentitySource.AzureArc, "localhost/token");

IManagedIdentityApplication mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
.WithHttpManager(httpManager)
.Build();
var miBuilder = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
.WithHttpManager(httpManager);

// Disabling shared cache options to avoid cross test pollution.
miBuilder.Config.AccessorOptions = null;

var mi = miBuilder.Build();

MsalManagedIdentityException ex = await Assert.ThrowsExceptionAsync<MsalManagedIdentityException>(async () =>
await mi.AcquireTokenForManagedIdentity(ManagedIdentityTests.Resource)
Expand Down

0 comments on commit e661354

Please sign in to comment.