Skip to content

9.1 Test Templates don't use new 9.1 Test Features #7606

@afscrome

Description

@afscrome

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

A lot of new testing goodness has been added in Aspire 9.1, but the test templates have hardly changed so don't expose much of this.

(This issue assumes that https://github.com/dotnet/aspire/tree/main/src/Aspire.ProjectTemplates/templates/aspire-starter/9.1/Aspire-StarterApplication.1.Tests is the intended template due to #7603)

Describe the solution you'd like

  1. app.Services.GetRequiredService<ResourceNotificationService>() should be replaced with app.ResourceNotifications

  2. In order to get details about health check failures and resources not ending up in the expected state, we should consider adding the following to app host configuration in the default test. Users can opt out of these if they don't need them, but by having them in the default template, it's a strong indicator to users that these logs may be useful.

appHost.Services.AddLogging(l => l
    .AddFilter("Aspire.Hosting.ApplicationModel.ResourceNotificationService", LogLevel.Debug)
    .AddFilter("Aspire.Hosting.Health.ResourceHealthCheckService", LogLevel.Debug));
  1. Cancellation/Timeouts should be added to the app.StartAsync() call, as this could hang indefinitely in certain chains of WaitFor dependencies, so that users can see the health check & resource notification logs to see why their test hung. (For completeness, cancellation also ought to be added to the appHost.BuildAsync and httpClientGetAsync())

  2. Should WaitForResourceAsync be replaced with WaitForResourceHealthyAsync

Additional context

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions