dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.91k stars 475 forks source link

Aspire integration test hangs on WaitForCompletion, but works when running dashboard normally #6695

Closed ealeykin closed 4 days ago

ealeykin commented 5 days ago

Is there an existing issue for this?

Describe the bug

Having the following solution:

  1. Aspire
  2. Aspire.Tests
  3. Host1 (exists after 5 sec)
  4. Host2
var db = builder.AddPostgres("postgres");

var host1 = builder
    .AddProject<Projects.WebApplication1>("Host1")
    .WithReference(db)
    .WaitFor(db);

var host2 = builder
    .AddProject<Projects.WebApplication2>("Host2")
    .WithReference(db)
    .WaitFor(db)
    .WaitForCompletion(host1);
var builder = await DistributedApplicationTestingBuilder.CreateAsync<Projects.Aspire>();
var app = await builder.BuildAsync();
await app.StartAsync();

The cause is this .WaitForCompletion(host1) - removing this will allow integration test to complete. Looking into logs, despite host1 was actually terminated - aspire never receives Finished notification.

What might be the reason?

Thanks

Expected Behavior

Integration test completes

Steps To Reproduce

Repository with a solution to reproduce the issue:

https://github.com/ealeykin/aspire_health_issue

Exceptions (if any)

No response

.NET Version info

.NET SDK: Version: 9.0.100 Commit: 59db016f11 Workload version: 9.0.100-manifests.c6f19616 MSBuild version: 17.12.7+5b8665660

Runtime Environment: OS Name: Mac OS X OS Version: 14.5 OS Platform: Darwin RID: osx-arm64 Base Path: /usr/local/share/dotnet/sdk/9.0.100/

.NET workloads installed: [aspire] Installation Source: SDK 9.0.100 Manifest Version: 8.2.2/8.0.100 Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire/8.2.2/WorkloadManifest.json Install Type: FileBased

Configured to use loose manifests when installing new manifests.

Host: Version: 9.0.0 Architecture: arm64 Commit: 9d5a6a9aa4

.NET SDKs installed: 8.0.300 [/usr/local/share/dotnet/sdk] 8.0.404 [/usr/local/share/dotnet/sdk] 9.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Anything else?

No response

davidfowl commented 5 days ago

Seems to work:

Image

ealeykin commented 4 days ago

The issue is only reproducible when running tests in Rider. dotnet test works as expected, so closing the issue.