Commit ea3e182
authored
[tests] Add support for running EndToEnd tests on helix with the
# Problem:
1. We want to run some EndToEnd tests on CI, which can `dotnet run` an aspire project,
and allow individual tests to interact with the services.
This requires:
- Ability to build, and run an aspire project - IOW, a sdk with the `aspire` workload installed.
- `docker`
2. Also, allow using `TestProject.*` in `tests/testproject`, in two modes:
- `in-tree` test run which directly reference aspire projects, and repo targets
- `out-of-tree` test runs which uses a SDK+workload based on local build output
# Solution:
### SDK+workload
- SDK with version from `global.json` is installed into `artifacts/bin/dotnet-{none,latest}`
- The `aspire` workload is installed into the sdk using the nuget packages in `artifacts/packages` with a version like `8.0.0-{dev,ci}`
- this also allows running tests that do `dotnet new aspire-starter; dotnet run` same as a user
- this utilizes an internal nuget from `dotnet/runtime`
### TestProject
- This can switch between the two test run modes using the msbuild property `$(TestsRunningOutsideRepo)`
- when running `in-tree` the test project directly references hosting targets, and aspire projects via `ProjectReference`
- when running `out-of-tree` the `ProjectReferences` and imports are replaced with `PackageReferences` to the Aspire nugets
- Default is to run `in-tree`
### Helix
- The tests are built on the build machine
- The testproject, and the sdk+workload is sent to helix
- where the tests run using `dotnet` from the sdk+workload path
- Since `docker` is needed to helix, this is enabled only for `Linux` in this PR. Blocked on dotnet/dnceng#2067 for windows support.
## TL;dr or How do I use this?
### Steps to prepare for `out-of-tree` runs
1. `.\build.cmd -pack` - to build all the nugets
2. `dotnet build tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.csproj /t:InstallWorkloadUsingArtifacts /p:Configuration=<config>`
- this will install the sdk, and the `aspire` workload using the nugets from `artifacts/packages`
- at this point the sdk is usable outside the repo too. Note: you need to add `artifacts/packages/$(Configuration)/Shipping` as a nuget source so the locally built packages can be picked up.
### Using it from VS
- No difference when running the EndToEnd tests in `in-tree` mode
- For switching to `out-of-tree` add `<TestsRunningOutsideRepo>true</TestsRunningOutsideRepo>` to `tests/Aspire.EndToEnd.Tests/Directory.props` *before* any imports.
- tests cannot be run at this point as they will fail complaining about `artifacts/bin/dotnet-latest` being missing
- Install the sdk+workload 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 like `artifacts/bin/Aspire.EndToEnd.Tests/Debug/net8.0/testassets/testproject/`
### Using it from command line
- No difference when running the EndToEnd tests in `in-tree` mode
- Install the sdk+workload following the steps above
- When running the tests you can either:
- set `<TestsRunningOutsideRepo>true</TestsRunningOutsideRepo>` to `tests/Aspire.EndToEnd.Tests/Directory.props` before any imports
- or set the environment variable `TestsRunningOutsideRepo=true`
### Other details
- `tests/Shared/WorkloadTesting` - has sources essentially from `dotnet/runtime`'s `Wasm.Build.Tests`
- TestProject supports skipping individual resources like `--skip-resources oracledatabase,cosmos`
- `.runsettings` with 15min timeout
- `xunit.runner.json` - to get diagnostic messages
- The core infrastructure is not specific for `Aspire.EndToEnd.Tests`, and will get used by other test projects in the future
###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/aspire/pull/2534)aspire workload (#2534)1 parent a6581e5 commit ea3e182
File tree
49 files changed
+1552
-207
lines changed- eng
- dashboardpack
- dcppack
- pipelines/templates
- testing
- workloads
- src
- Microsoft.NET.Sdk.Aspire
- tests
- Aspire.EndToEnd.Tests
- testproject
- Common
- TestProject.AppHost
- TestProject.IntegrationServiceA
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+1552
-207
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
42 | 55 | | |
43 | | - | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
| |||
52 | 64 | | |
53 | 65 | | |
54 | 66 | | |
55 | | - | |
| 67 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
29 | 42 | | |
30 | 43 | | |
31 | 44 | | |
| |||
42 | 55 | | |
43 | 56 | | |
44 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
45 | 68 | | |
46 | 69 | | |
47 | 70 | | |
48 | | - | |
| 71 | + | |
49 | 72 | | |
50 | 73 | | |
51 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments