Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5f6bf0e
Initial plan
Copilot Nov 2, 2025
85a3e07
Refactor ACR authentication to use Azure SDK TokenCredential
Copilot Nov 2, 2025
2af559c
Fix test project builds - add InternalsVisibleTo and remove duplicate…
Copilot Nov 2, 2025
6b7230e
Address code review feedback - remove duplicate login implementation
Copilot Nov 2, 2025
f24e54f
Address security concerns from code review
Copilot Nov 2, 2025
2a80106
Make IContainerRuntime public and remove unnecessary InternalsVisibleTo
Copilot Nov 2, 2025
5deca0e
Make IContainerRuntime experimental and use shared source for process…
Copilot Nov 2, 2025
33c8aa7
Update Azure deployer tests to mock IContainerRuntime LoginToRegistry…
Copilot Nov 2, 2025
64c1053
Complete Azure deployer test updates - all tests now mock IContainerR…
Copilot Nov 2, 2025
8db746b
Fix DeployAsync_WithMultipleComputeEnvironments_Works test - pass fak…
Copilot Nov 2, 2025
4c1f43c
Fix ACR authentication scope - use .net instead of .com
Copilot Nov 2, 2025
3d4e7c3
Improve ACR login debugging and stdin handling
Copilot Nov 2, 2025
b26aafc
Fix ACR authentication to use correct OAuth2 token exchange
Copilot Nov 2, 2025
dacdad9
Refactor ACR authentication to use IAcrLoginService with IHttpClientF…
Copilot Nov 2, 2025
29e487a
Move IContainerRuntime to AcrLoginService constructor dependency
Copilot Nov 3, 2025
f4e87fd
Fix test failures - add FakeAcrLoginService to mock ACR OAuth2 calls
Copilot Nov 3, 2025
db3f0bb
Make tenantId required in IAcrLoginService.LoginAsync
Copilot Nov 3, 2025
6a317ed
Fix test failures - FakeAcrLoginService needs IContainerRuntime const…
Copilot Nov 3, 2025
db90153
Address PR feedback - optimize HTTP client usage and JSON deserializa…
Copilot Nov 4, 2025
2de6948
Fix compilation error and use singleton JsonSerializerOptions
Copilot Nov 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/Aspire.Hosting.Azure.Tests/AzureDeployerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ private static void ConfigureTestServices(IDistributedApplicationTestingBuilder
builder.Services.AddSingleton<IProcessRunner>(processRunner ?? new MockProcessRunner());
builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>();
builder.Services.AddSingleton<IContainerRuntime>(containerRuntime ?? new FakeContainerRuntime());
builder.Services.AddSingleton<IAcrLoginService, FakeAcrLoginService>();
builder.Services.AddSingleton<IAcrLoginService>(sp => new FakeAcrLoginService(sp.GetRequiredService<IContainerRuntime>()));
}

private sealed class NoOpDeploymentStateManager : IDeploymentStateManager
Expand Down Expand Up @@ -1179,7 +1179,7 @@ private static void ConfigureTestServicesWithFileDeploymentStateManager(
builder.Services.AddSingleton<IProcessRunner>(new MockProcessRunner());
builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>();
builder.Services.AddSingleton<IContainerRuntime>(new FakeContainerRuntime());
builder.Services.AddSingleton<IAcrLoginService, FakeAcrLoginService>();
builder.Services.AddSingleton<IAcrLoginService>(sp => new FakeAcrLoginService(sp.GetRequiredService<IContainerRuntime>()));
Copy link
Member

Choose a reason for hiding this comment

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

@copilot this change cam be reverted.

}

private sealed class TestPublishingActivityReporter : IPipelineActivityReporter
Expand Down
19 changes: 17 additions & 2 deletions tests/Aspire.Hosting.Azure.Tests/FakeAcrLoginService.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIRECONTAINERRUNTIME001

using Aspire.Hosting.Publishing;
using Azure.Core;

namespace Aspire.Hosting.Azure.Tests;

internal sealed class FakeAcrLoginService : IAcrLoginService
{
private const string AcrUsername = "00000000-0000-0000-0000-000000000000";

private readonly IContainerRuntime _containerRuntime;

public bool WasLoginCalled { get; private set; }
public string? LastRegistryEndpoint { get; private set; }
public string? LastTenantId { get; private set; }

public Task LoginAsync(
public FakeAcrLoginService(IContainerRuntime containerRuntime)
{
_containerRuntime = containerRuntime ?? throw new ArgumentNullException(nameof(containerRuntime));
}

public async Task LoginAsync(
string registryEndpoint,
string tenantId,
TokenCredential credential,
Expand All @@ -20,6 +32,9 @@ public Task LoginAsync(
WasLoginCalled = true;
LastRegistryEndpoint = registryEndpoint;
LastTenantId = tenantId;
return Task.CompletedTask;

// Call the container runtime to match real implementation behavior
// This allows tests to verify the container runtime was called
await _containerRuntime.LoginToRegistryAsync(registryEndpoint, AcrUsername, "fake-refresh-token", cancellationToken);
}
}
Loading