-
Notifications
You must be signed in to change notification settings - Fork 526
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
[tests] Add Aspire.Playground.Tests
#5208
Conversation
.. to disambiguate the project binaries in `artifacts`
Playground apps add a reference to the Dashboard project for local debugging. Skip that when building for tests.
…nts needed for testing
.. with test infrastructure (`tests/Aspire.Playground.Tests/Infrastructure/`) taken from aspire-samples repo.
.. under a new category - `buildforhelixtests`. This is for any tests that expect to build the tests project itself on helix, and then run it there.
.. props file. This allows project builds where test packages are added by default to work by providing the package versions for those packages.
As part of this it would be good to ensure that the the content of aspire-manifest.json has not changed in each of the playground projects. We want to detect if the apphost is generating a manifest different to what is checked in so that we can identify changes that we didn't intend (it also helps with the review process). |
Added to #5210 |
@@ -0,0 +1,23 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this copy of this file? Can we use the default one in the root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to allow the source being buildable from outside the repo, as we wouldn't have eng/testing/.runsettings
available there.
The alternative would be to copy it for the archive, and also have a <RunSettingsFilePath Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory).runsettings</RunSettingsFilePath>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just have the root .runsettings
file checked into the repo, and then the infrastructure copies it to the correct place in the helix payload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will get covered by the follow up task of building on the build machine, and only running on helix.
<Compile Include="$(TestsSharedDir)WorkloadTesting\EnvironmentVariables.cs" /> | ||
<Compile Include="$(TestsSharedDir)Logging\*.cs" /> | ||
|
||
<AspireProjectOrPackageReference Include="Aspire.Hosting" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we rebuild the Aspire.Playground.Tests in Helix? If so, why? Why don't we build this project on the build machine, and then run the already built tests on Helix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I think this can be reworked so this project builds on the build machine. Then we can build the playground projects on helix, and point the tests to the bindir for these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need some reworking. I have added it as a follow up task in #5210 . We can get the tests checked-in before that.
<ProjectReference Include="$(PlaygroundSourceDir)ProxylessEndToEnd/ProxylessEndToEnd.AppHost/ProxylessEndToEnd.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> | ||
<ProjectReference Include="$(PlaygroundSourceDir)Qdrant/Qdrant.AppHost/Qdrant.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> | ||
<ProjectReference Include="$(PlaygroundSourceDir)TestShop/TestShop.AppHost/TestShop.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> | ||
<ProjectReference Include="$(PlaygroundSourceDir)mongo/Mongo.AppHost/Mongo.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> | ||
<ProjectReference Include="$(PlaygroundSourceDir)mysql/MySqlDb.AppHost/MySqlDb.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> | ||
<ProjectReference Include="$(PlaygroundSourceDir)nats/Nats.AppHost/Nats.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> | ||
<ProjectReference Include="$(PlaygroundSourceDir)seq/Seq.AppHost/Seq.AppHost.csproj" AdditionalProperties="SkipDashboardProjectReference=true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only some of these? Why not all?
Should we do it like the aspire-samples does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/Aspire.Playground.Tests/Infrastructure/PasswordGenerator.cs
Outdated
Show resolved
Hide resolved
…Aspire.Hosting instead of duplicating from aspire-samples
@@ -12,6 +12,7 @@ | |||
|
|||
var app = builder.Build(); | |||
|
|||
app.MapDefaultEndpoints(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually interesting that we weren't calling this in the past but we were Adding Service Defaults. Do you happen to know why? Why do we need it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need it to get the /alive
, and /health
endpoints being used by the tests. When running it manually, it wasn't useful I'm guessing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great work, @radical. Nice job.
Let's get this in and get more tests enabled.
<!-- Import only when in-repo. For the out-of-repo case a parent Directory.Build.targets does the import --> | ||
<Import Project="$(TestsSharedRepoTestingDir)Aspire.RepoTesting.targets" Condition="'$(RepoRoot)' != ''" /> | ||
|
||
<PropertyGroup Condition="'$(TestsRunningOutsideOfRepo)' == 'true' or '$(SkipDashboardProjectReference)' == 'true'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<PropertyGroup Condition="'$(TestsRunningOutsideOfRepo)' == 'true' or '$(SkipDashboardProjectReference)' == 'true'"> | |
<PropertyGroup Condition="'$(SkipDashboardProjectReference)' == 'true'"> |
When are these tests running outside of the repo and SkipDashboardProjectReference is not set?
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Condition="'$(RepoRoot)' != ''" Include="$(RepoRoot)src\Aspire.Hosting\Utils\PasswordGenerator.cs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this build when RepoRoot
isn't set? WithRandomParameterValues
needs this code in order to build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We copy the source to the test directory in the archive for helix, so it gets picked up by msbuild as part of collecting the all .cs
files.
|
||
public AppHostTests(ITestOutputHelper testOutput) | ||
{ | ||
this._testOutput = new TestOutputWrapper(testOutput); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this TestOutputWrapper
? Why can't we use the ITestOutputHelper
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful to see the output streaming to testOutputHelper
when the test run might be taking long. But in the case of these tests most of the output is being logged to the console anyway, so we can drop this.
|
||
public AppHostTests(ITestOutputHelper testOutput) | ||
{ | ||
this._testOutput = new TestOutputWrapper(testOutput); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit)
this._testOutput = new TestOutputWrapper(testOutput); | |
_testOutput = new TestOutputWrapper(testOutput); |
Merging this, and will open follow up PRs for the suggestions. |
.. from @ eerhardt . Follow up for #5208 .
Add wrapper tests for apps in
playground/
.This effectively increases coverage for various components like Qdrant, and Seq, and their hosting bits.
Details:
MapDefaultEndpoints
to add/alive
and/health
endpoints needed for testingplayground/TestShop/ServiceDefaults
toplayground/TestShop/TestShop.ServiceDefaults
to disambiguate the project binaries inartifacts
Contributes to #4297 .
Microsoft Reviewers: Open in CodeFlow