-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds integration test for the InMemoryRuntime (#4659)
* adds integration test for the InMemoryRuntime * format * expand timeout for in memory runtime tests
- Loading branch information
Showing
6 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...Microsoft.AutoGen.Integration.Tests.AppHosts/HelloAgent.AppHost/HelloAgent.AppHost.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" /> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsAspireHost>true</IsAspireHost> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Aspire.Hosting.AppHost" /> | ||
<PackageReference Include="Aspire.Hosting" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\samples\Hello\HelloAgent\HelloAgent.csproj" /> | ||
</ItemGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
dotnet/test/Microsoft.AutoGen.Integration.Tests.AppHosts/HelloAgent.AppHost/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Program.cs | ||
|
||
using Microsoft.Extensions.Hosting; | ||
|
||
var appHost = DistributedApplication.CreateBuilder(); | ||
appHost.AddProject<Projects.HelloAgent>("HelloAgentsDotNetInMemoryRuntime"); | ||
var app = appHost.Build(); | ||
await app.StartAsync(); | ||
await app.WaitForShutdownAsync(); |
43 changes: 43 additions & 0 deletions
43
...soft.AutoGen.Integration.Tests.AppHosts/HelloAgent.AppHost/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"profiles": { | ||
"https": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"dotnetRunMessages": true, | ||
"applicationUrl": "https://localhost:15887;http://localhost:15888", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development", | ||
//"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16037", | ||
"DOTNET_DASHBOARD_OTLP_HTTP_ENDPOINT_URL": "https://localhost:16038", | ||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:17037", | ||
"DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES": "true" | ||
} | ||
}, | ||
"http": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"dotnetRunMessages": true, | ||
"applicationUrl": "http://localhost:15888", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development", | ||
//"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16031", | ||
"DOTNET_DASHBOARD_OTLP_HTTP_ENDPOINT_URL": "http://localhost:16032", | ||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:17031", | ||
"DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES": "true", | ||
"ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true" | ||
} | ||
}, | ||
"generate-manifest": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"commandLineArgs": "--publisher manifest --output-path aspire-manifest.json", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development" | ||
} | ||
} | ||
}, | ||
"$schema": "https://json.schemastore.org/launchsettings.json" | ||
} |
43 changes: 43 additions & 0 deletions
43
dotnet/test/Microsoft.AutoGen.Integration.Tests/InMemoryRuntimeIntegrationTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// InMemoryRuntimeIntegrationTests.cs | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.AutoGen.Integration.Tests; | ||
|
||
public class InMemoryRuntimeIntegrationTests(ITestOutputHelper testOutput) | ||
{ | ||
|
||
[Theory, Trait("type", "integration")] | ||
[MemberData(nameof(AppHostAssemblies))] | ||
public async Task HelloAgentsE2EInMemory(string appHostAssemblyPath) | ||
{ | ||
var appHost = await DistributedApplicationTestFactory.CreateAsync(appHostAssemblyPath, testOutput); | ||
await using var app = await appHost.BuildAsync().WaitAsync(TimeSpan.FromSeconds(15)); | ||
|
||
await app.StartAsync().WaitAsync(TimeSpan.FromSeconds(120)); | ||
await app.WaitForResourcesAsync().WaitAsync(TimeSpan.FromSeconds(120)); | ||
|
||
await app.StartAsync().WaitAsync(TimeSpan.FromSeconds(120)); | ||
await app.WaitForResourcesAsync().WaitAsync(TimeSpan.FromSeconds(120)); | ||
|
||
//sleep 5 seconds to make sure the app is running | ||
await Task.Delay(15000); | ||
app.EnsureNoErrorsLogged(); | ||
app.EnsureLogContains("Hello World"); | ||
app.EnsureLogContains("HelloAgents said Goodbye"); | ||
|
||
await app.StopAsync().WaitAsync(TimeSpan.FromSeconds(15)); | ||
} | ||
public static TheoryData<string> AppHostAssemblies() | ||
{ | ||
var appHostAssemblies = GetSamplesAppHostAssemblyPaths(); | ||
var theoryData = new TheoryData<string, bool>(); | ||
return new(appHostAssemblies.Select(p => Path.GetRelativePath(AppContext.BaseDirectory, p))); | ||
} | ||
private static IEnumerable<string> GetSamplesAppHostAssemblyPaths() | ||
{ | ||
// All the AppHost projects are referenced by this project so we can find them by looking for all their assemblies in the base directory | ||
return Directory.GetFiles(AppContext.BaseDirectory, "HelloAgent.AppHost.dll") | ||
.Where(fileName => !fileName.EndsWith("Aspire.Hosting.AppHost.dll", StringComparison.OrdinalIgnoreCase)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters