Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor functional tests #2037

Merged
merged 11 commits into from
Feb 5, 2024
Merged

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Feb 2, 2024

  • Split the functional Components Integration tests out of Aspire.Hosting.Tests into a new EndToEnd project.
  • Start the test AppHost project using dotnet run instead of running the DistributedAppBuilder inline in the tests. This allows for the tests to run on a separate machine than where the tests are built. - Along with this, we need to pass information from the test AppHost to the test about its endpoints, and give it a signal to "stop". Instead of trying to find a way to CTRL+C cross-platform, read from stdin for a "Stop" command.

The main new code is in EndToEnd.Tests TestProgramFixture.cs.

Microsoft Reviewers: Open in CodeFlow

@eerhardt eerhardt requested a review from radical February 2, 2024 00:20
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-integrations Issues pertaining to Aspire Integrations packages label Feb 2, 2024
- Split the functional Components Integration tests out of Aspire.Hosting.Tests into a new EndToEnd project.
- Start the test AppHost project using `dotnet run` instead of running the DistributedAppBuilder inline in the tests. This allows for the tests to run on a separate machine than where the tests are built.
    - Along with this, we need to pass information from the test AppHost to the test about its endpoints, and give it a signal to "stop". Instead of trying to find a way to CTRL+C cross-platform, read from stdin for a "Stop" command.
The tests will run for as long as they need to. The larger timeout will handle any real hangs.

Also handle retries in Cosmos.
Also set up resilience handler for the HttpClient.
Also set EnableRaisingEvents so Exited fires.
@eerhardt eerhardt marked this pull request as ready for review February 3, 2024 03:58
Until they can be run in Helix
@mitchdenny
Copy link
Member

Over the weekend I was playing with the idea of disabling certain components/routes in the test project depending on what connection strings were populated and then using the AppHost to selectively enable the various dependent services. The idea being that for any given integration test you could narrow the scope of the containers that you were launching and improve performance.

I think it would be good to tackle this at the same time or as a fast follow on this PR.

@mitchdenny mitchdenny added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Feb 5, 2024
@mitchdenny mitchdenny added this to the preview 4 (Mar) milestone Feb 5, 2024
@eerhardt
Copy link
Member Author

eerhardt commented Feb 5, 2024

Over the weekend I was playing with the idea of disabling certain components/routes in the test project depending on what connection strings were populated and then using the AppHost to selectively enable the various dependent services. The idea being that for any given integration test you could narrow the scope of the containers that you were launching and improve performance.

I think it would be good to tackle this at the same time or as a fast follow on this PR.

This is tracked by #1704. (cc @ReubenBond @DamianEdwards).

@eerhardt eerhardt enabled auto-merge (squash) February 5, 2024 21:24
@eerhardt eerhardt enabled auto-merge (squash) February 5, 2024 21:24
@eerhardt eerhardt merged commit 7151a30 into dotnet:main Feb 5, 2024
8 checks passed
@eerhardt eerhardt deleted the SplitIntegrationTests branch February 5, 2024 23:46
radical pushed a commit to radical/aspire that referenced this pull request Feb 6, 2024
* Refactor functional tests

- Split the functional Components Integration tests out of Aspire.Hosting.Tests into a new EndToEnd project.
- Start the test AppHost project using `dotnet run` instead of running the DistributedAppBuilder inline in the tests. This allows for the tests to run on a separate machine than where the tests are built.
    - Along with this, we need to pass information from the test AppHost to the test about its endpoints, and give it a signal to "stop". Instead of trying to find a way to CTRL+C cross-platform, read from stdin for a "Stop" command.

* Collapse integration tests into one class.

* Make common tests into a theory

* Remove timeouts from tests.

The tests will run for as long as they need to. The larger timeout will handle any real hangs.

Also handle retries in Cosmos.

* Write output when running the AppHost times out.

* Disable the TestProject's dashboard during test run.

Also set up resilience handler for the HttpClient.

* Log stderr and handle waiting better.

Also set EnableRaisingEvents so Exited fires.

* Make EndToEnd tests local-only

Until they can be run in Helix
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants