mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-07 21:34:00 +00:00
adds integration test for the InMemoryRuntime (#4659)
* adds integration test for the InMemoryRuntime * format * expand timeout for in memory runtime tests
This commit is contained in:
parent
34b997769e
commit
7d01bc6136
@ -134,6 +134,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AutoGen.Agents.Te
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AutoGen.Integration.Tests", "test\Microsoft.AutoGen.Integration.Tests\Microsoft.AutoGen.Integration.Tests.csproj", "{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AutoGen.Integration.Tests", "test\Microsoft.AutoGen.Integration.Tests\Microsoft.AutoGen.Integration.Tests.csproj", "{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloAgent.AppHost", "test\Microsoft.AutoGen.Integration.Tests.AppHosts\HelloAgent.AppHost\HelloAgent.AppHost.csproj", "{99D7766B-076F-4E6F-A8D2-3DF1DAFA2599}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -348,6 +350,10 @@ Global
|
|||||||
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{99D7766B-076F-4E6F-A8D2-3DF1DAFA2599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{99D7766B-076F-4E6F-A8D2-3DF1DAFA2599}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{99D7766B-076F-4E6F-A8D2-3DF1DAFA2599}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{99D7766B-076F-4E6F-A8D2-3DF1DAFA2599}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -409,6 +415,7 @@ Global
|
|||||||
{65059914-5527-4A00-9308-9FAF23D5E85A} = {18BF8DD7-0585-48BF-8F97-AD333080CE06}
|
{65059914-5527-4A00-9308-9FAF23D5E85A} = {18BF8DD7-0585-48BF-8F97-AD333080CE06}
|
||||||
{394FDAF8-74F9-4977-94A5-3371737EB774} = {F823671B-3ECA-4AE6-86DA-25E920D3FE64}
|
{394FDAF8-74F9-4977-94A5-3371737EB774} = {F823671B-3ECA-4AE6-86DA-25E920D3FE64}
|
||||||
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31} = {F823671B-3ECA-4AE6-86DA-25E920D3FE64}
|
{D04C6153-8EAF-4E54-9852-52CEC1BE8D31} = {F823671B-3ECA-4AE6-86DA-25E920D3FE64}
|
||||||
|
{99D7766B-076F-4E6F-A8D2-3DF1DAFA2599} = {F823671B-3ECA-4AE6-86DA-25E920D3FE64}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {93384647-528D-46C8-922C-8DB36A382F0B}
|
SolutionGuid = {93384647-528D-46C8-922C-8DB36A382F0B}
|
||||||
|
|||||||
@ -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>
|
||||||
@ -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();
|
||||||
@ -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"
|
||||||
|
}
|
||||||
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\samples\Hello\Hello.AppHost\Hello.AppHost.csproj" />
|
<ProjectReference Include="..\..\samples\Hello\Hello.AppHost\Hello.AppHost.csproj" />
|
||||||
|
<ProjectReference Include="..\..\samples\Hello\HelloAgent\HelloAgent.csproj" />
|
||||||
|
<ProjectReference Include="..\Microsoft.AutoGen.Integration.Tests.AppHosts\HelloAgent.AppHost\HelloAgent.AppHost.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Properties, Items, and targets to ensure Python apps are initialized -->
|
<!-- Properties, Items, and targets to ensure Python apps are initialized -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user