The purpose of the Aspire.EndToEnd.Tests project is to run end-to-end tests against pre-built NuGet packages (nupkgs). These tests validate the ability to build, run, and interact with Aspire projects in both in-repo and outside-of-repo modes, ensuring compatibility with CI pipelines and local development environments.
For pull-requests in CI the tests are run via GitHub actions defined in tests-integration.yml.
- For switching to
outside-of-reposet<_BuildForTestsRunningOutsideOfRepo>true</_BuildForTestsRunningOutsideOfRepo>in the project file.- tests cannot be run at this point as they will fail complaining about
artifacts/bin/dotnet-latestbeing missing - Install the SDK following the steps above
- Run/debug the tests normally now, and they will be using the SDK
- Also note that in this case the testproject is run from the bindir for
Aspire.EndToEnd.Tests, so a path likeartifacts/bin/Aspire.EndToEnd.Tests/Debug/net8.0/testassets/testproject/
- tests cannot be run at this point as they will fail complaining about
- When running the tests you can either:
- set
<TestsRunningOutsideOfRepo>true</TestsRunningOutsideOfRepo>totests/Aspire.EndToEnd.Tests/Directory.propsbefore any imports - or set the environment variable
TestsRunningOutsideOfRepo=true
- set
The following changes need to be made to when adding a new integration:
- Add a new
TestResourceNamesenum entry. - Add ProjectReference to the new resource/integration from the TestProject.AppHost and TestProject.IntegrationServiceA projects.
- Add PackageVersion entries to the new packages in Directory.Packages.Helix.props
- Add entries to the AppHost.cs/Program.cs of both the AppHost and IntegrationServiceA projects.
- Add a test in IntegrationServicesTests
- If the integration's container starts in a reasonable time, the new test can just be a new
[InlineData]entry to the existingVerifyComponentWorkstest. - If the container takes a long time to start, or is flaky, add a separate test scenario (similar to Oracle and CosmosDb).
- If the integration's container starts in a reasonable time, the new test can just be a new
See #4179 for an example.
-
We want to run some EndToEnd tests on CI, which can
dotnet runan Aspire project, and allow individual tests to interact with the services. This requires:- Ability to build, and run an Aspire project - in other words, an SDK with the necessary components installed.
docker
-
Also, allow using
TestProject.*intests/testproject, in two modes:
in-repotest run which directly reference Aspire projects, and repo targetsoutside-of-repotest runs which uses a SDK based on local build output
- This can switch between the two test run modes using the msbuild property
$(TestsRunningOutsideOfRepo)- when running
in-repothe test project directly references hosting targets, and Aspire projects viaProjectReference - when running
outside-of-repotheProjectReferencesand imports are replaced withPackageReferencesto the Aspire nugets
- when running
- Default is to run
in-repo
- The tests are built on the build machine
- The testproject, and the SDK is sent to Helix
- where the tests run using
dotnetfrom the SDK path
- where the tests run using
- Since
dockeris needed to Helix, this is enabled only forLinuxin this PR. Blocked on dotnet/dnceng#2067 for windows support.