Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 11 additions & 10 deletions tests/Aspire.Hosting.Azure.Tests/AzureAIFoundryExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Aspire.Hosting.Azure.Tests;

public class AzureAIFoundryExtensionsTests
public class AzureAIFoundryExtensionsTests(ITestOutputHelper testOutputHelper)
{
[Fact]
public void AddAzureAIFoundry_ShouldAddResourceToBuilder()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var resourceBuilder = builder.AddAzureAIFoundry("myAIFoundry");
Assert.NotNull(resourceBuilder);
var resource = Assert.Single(builder.Resources.OfType<AzureAIFoundryResource>());
Expand All @@ -23,7 +23,7 @@ public void AddAzureAIFoundry_ShouldAddResourceToBuilder()
[Fact]
public void AddDeployment_ShouldAddDeploymentToResource()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var resourceBuilder = builder.AddAzureAIFoundry("myAIFoundry");
var deploymentBuilder = resourceBuilder.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");
Assert.NotNull(deploymentBuilder);
Expand All @@ -39,7 +39,7 @@ public void AddDeployment_ShouldAddDeploymentToResource()
[Fact]
public void WithProperties_ShouldApplyConfiguration()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var resourceBuilder = builder.AddAzureAIFoundry("myAIFoundry");
var deploymentBuilder = resourceBuilder.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");
bool configured = false;
Expand All @@ -57,7 +57,7 @@ public void WithProperties_ShouldApplyConfiguration()
[Fact]
public void AddAzureAIFoundry_ConnectionString_IsCorrect()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var resourceBuilder = builder.AddAzureAIFoundry("myAIFoundry");
var resource = Assert.Single(builder.Resources.OfType<AzureAIFoundryResource>());
// The connection string should reference the aiFoundryApiEndpoint output
Expand All @@ -71,7 +71,7 @@ public async Task RunAsFoundryLocal_SetsIsEmulator()
{
var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));

using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var resourceBuilder = builder.AddAzureAIFoundry("myAIFoundry");
var resource = Assert.Single(builder.Resources.OfType<AzureAIFoundryResource>());
Assert.False(resource.IsEmulator);
Expand Down Expand Up @@ -99,7 +99,7 @@ public async Task RunAsFoundryLocal_SetsIsEmulator()
[Fact]
public void RunAsFoundryLocal_DeploymentIsMarkedLocal()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var resourceBuilder = builder.AddAzureAIFoundry("myAIFoundry");
resourceBuilder.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");
var localBuilder = resourceBuilder.RunAsFoundryLocal();
Expand All @@ -115,7 +115,7 @@ public void RunAsFoundryLocal_DeploymentIsMarkedLocal()
[Fact]
public void RunAsFoundryLocal_DeploymentConnectionString_HasModelProperty()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var foundry = builder.AddAzureAIFoundry("myAIFoundry");
var deployment = foundry.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");

Expand All @@ -134,7 +134,7 @@ public void RunAsFoundryLocal_DeploymentConnectionString_HasModelProperty()
[Fact]
public void RunAsFoundryLocal_DeploymentConnectionString_UsesModelId()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var foundry = builder.AddAzureAIFoundry("myAIFoundry");
var deployment = foundry.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");
foundry.RunAsFoundryLocal();
Expand All @@ -147,7 +147,7 @@ public void RunAsFoundryLocal_DeploymentConnectionString_UsesModelId()
[Fact]
public void AIFoundry_DeploymentConnectionString_HasDeploymentProperty()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var foundry = builder.AddAzureAIFoundry("myAIFoundry");
var deployment = foundry.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");

Expand All @@ -161,6 +161,7 @@ public void AIFoundry_DeploymentConnectionString_HasDeploymentProperty()
public async Task AddAzureAIFoundry_GeneratesValidBicep()
{
using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Run);
builder.WithTestAndResourceLogging(testOutputHelper);

var foundry = builder.AddAzureAIFoundry("foundry");
var deployment1 = foundry.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AzureAppConfigurationExtensionsTests(ITestOutputHelper output)
[Fact]
public async Task AddAzureAppConfiguration()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(output);

var appConfig = builder.AddAzureAppConfiguration("appConfig");
appConfig.Resource.Outputs["appConfigEndpoint"] = "https://myendpoint";
Expand Down Expand Up @@ -109,7 +109,7 @@ public void AddAsExistingResource_ShouldBeIdempotent_ForAzureAppConfigurationRes
[Fact]
public async Task AddAsExistingResource_RespectsExistingAzureResourceAnnotation_ForAzureAppConfigurationResource()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(output);
var existingName = builder.AddParameter("existing-appconfig-name");
var existingResourceGroup = builder.AddParameter("existing-appconfig-rg");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Aspire.Hosting.Azure.Tests;

public class AzureAppServiceEnvironmentExtensionsTests
public class AzureAppServiceEnvironmentExtensionsTests(ITestOutputHelper testOutputHelper)
{
[Fact]
public void AddAsExistingResource_ShouldBeIdempotent_ForAzureAppServiceEnvironmentResource()
Expand All @@ -25,7 +25,7 @@ public void AddAsExistingResource_ShouldBeIdempotent_ForAzureAppServiceEnvironme
[Fact]
public async Task AddAsExistingResource_RespectsExistingAzureResourceAnnotation_ForAzureAppServiceEnvironmentResource()
{
using var builder = TestDistributedApplicationBuilder.Create();
using var builder = TestDistributedApplicationBuilder.Create(testOutputHelper);
var existingName = builder.AddParameter("existing-appenv-name");
var existingResourceGroup = builder.AddParameter("existing-appenv-rg");

Expand All @@ -42,4 +42,4 @@ public async Task AddAsExistingResource_RespectsExistingAzureResourceAnnotation_
await Verify(manifest.ToString(), "json")
.AppendContentAsFile(bicep, "bicep");
}
}
}
Loading