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

[tests] Move more tests to helix by overriding dcp path from assembly metadata #5215

Merged
merged 21 commits into from
Aug 8, 2024

Conversation

radical
Copy link
Member

@radical radical commented Aug 7, 2024

Description

AppHost build embeds metadata with paths for DcpCliPath, DcpExtensionsPath, and DcpBinPath. This ties the apphost to the machine that it was built on.
This PR:

  • When DcpPublisher:CliPath is available from the configuration, set the other two paths based on that.
  • Makes $(RunTestsOnHelix)=true the default.

This allows running most of the tests on helix. The remaining ones depend on being able to run the test projects which doesn't work on helix because the path to the project files is embedded in the assembly metadata.

Also, download helix test result .trx files to have all the .trx files available in artifacts.

Contributes to #2036 .

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
      • Link to aspire-docs issue:
    • No
Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-integrations Issues pertaining to Aspire Integrations packages label Aug 7, 2024
radical added 3 commits August 7, 2024 15:45
…ble ASPIRE_DCP_DIR

.. and instead of separate values for `DcpCliPath`, `DcpExtensionsPath`,
and `DcpBinPath`, use a single `DcpDir` path to compute all of them.
@radical radical force-pushed the patch-dcp-path-for-helix branch from 1775a96 to 23e182e Compare August 7, 2024 19:50
@radical radical marked this pull request as ready for review August 7, 2024 20:26
@radical radical requested a review from eerhardt as a code owner August 7, 2024 20:26
@karolz-ms karolz-ms requested a review from danegsta August 7, 2024 20:57
@@ -113,16 +111,22 @@ public void Configure(DcpOptions options)
var dcpPublisherConfiguration = configuration.GetSection(DcpPublisher);
var assemblyMetadata = appOptions.Assembly?.GetCustomAttributes<AssemblyMetadataAttribute>();

if (!string.IsNullOrEmpty(dcpPublisherConfiguration[nameof(options.CliPath)]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any backwards compatibility concerns we need to maintain here? For example, if someone used an 8.1 Aspire.Hosting.AppHost package and an 8.2 Aspire.Hosting package, I think this would break. Are we concerned about that level of mismatch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option would be to retain the 3 paths in the metadata as-is, but when DcpPublisher__CliPath is set then override the 3 paths based on the cliPath.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the change.

@radical radical requested a review from ReubenBond as a code owner August 7, 2024 23:59
@radical
Copy link
Member Author

radical commented Aug 8, 2024

@karolz-ms @danegsta This PR changes the behavior when you specify clipath config by computing the other 2 paths based on that. Does that break any assumptions?

@radical radical requested a review from eerhardt August 8, 2024 00:01
radical added 3 commits August 7, 2024 21:45
.. props file. This allows project builds where test packages are added
by default to work by providing the package versions for those packages.
@danegsta
Copy link
Member

danegsta commented Aug 8, 2024

@karolz-ms @danegsta This PR changes the behavior when you specify clipath config by computing the other 2 paths based on that. Does that break any assumptions?

That should be just fine.

</PropertyGroup>

<Target Name="BuildHelixWorkItemsForDefaultTests">
<ItemGroup>
<!-- needed for Aspire.Hosting.Container.Tests -->
<HelixPreCommand Include="$(_EnvVarSetKeyword) DOCKER_BUILDKIT=1" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to put this in the Hosting.Container.Tests so it doesn't need to be set everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be useful? Right now it would have to be by conditionally adding it on the work item itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking is that we wouldn't need a comment like <!-- needed for Aspire.Hosting.Container.Tests --> if it was in the Aspire.Hosting.Container.Tests project.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. In the follow up I'm generating run scripts which would allow individual test projects to control their own setups directly.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Nice work, let's get this in.

@radical radical merged commit 583014c into dotnet:main Aug 8, 2024
11 checks passed
@radical radical deleted the patch-dcp-path-for-helix branch August 8, 2024 23:01
@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants