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

[CI] Enable Workload tests for PR validation #7939

Merged
merged 15 commits into from
Mar 11, 2025

Conversation

radical
Copy link
Member

@radical radical commented Mar 6, 2025

  • Extract the existing job to enumerate the test class names to a custom action, so that it can be re-used
  • Split the jobs so linux, and windows ones can run independently. And can have separate list of tests.
  • Add a new workflow for running Workload tests, with a corresponding new action enumerate-template-tests
  • Disable tests on windows/CI that need to trust the SSL certificate
  • Also, add an artifact with all the test results for Integration, and Template workflows.

With this PR the setup jobs run independently for each OS, thus allowing their test jobs to start running immediately. This helps because Windows job can be a little slower, and doesn't block the Linux test jobs.

Fixes #7583 .

@radical radical force-pushed the re-enable-workload-tests branch from 67059c6 to 779d04c Compare March 6, 2025 20:20
@davidfowl
Copy link
Member

Can you rename these tests while you’re at it

@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
@radical radical force-pushed the re-enable-workload-tests branch from ec89e29 to 9e765f4 Compare March 11, 2025 04:32
@radical
Copy link
Member Author

radical commented Mar 11, 2025

Can you rename these tests while you’re at it

I'll have a separate PR for that. There are a whole bunch of places with Workload in the name.

@radical radical marked this pull request as ready for review March 11, 2025 04:49
@Copilot Copilot bot review requested due to automatic review settings March 11, 2025 04:49
@radical radical requested a review from eerhardt as a code owner March 11, 2025 04:49
@radical radical requested a review from joperezr March 11, 2025 04:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR enables Workload tests for PR validation by adding SSL certificate requirements to tests and updating the CI workflows and test project configurations. The key changes include:

  • New SSL certificate attribute and trait discoverer to gate tests on proper environment support.
  • Updates to composite GitHub actions and workflows to generate test matrices for both template and general tests.
  • Modifications to several test projects, including renaming a base test class and adding the new SSL requirement attribute.

Reviewed Changes

File Description
tests/Aspire.Components.Common.Tests/RequiresSSLCertificateAttribute.cs Adds attribute to require SSL certificate for tests.
tests/Aspire.Components.Common.Tests/RequiresSSLCertificateDiscoverer.cs Implements trait discovery based on SSL certificate support.
.github/actions/enumerate-template-tests/action.yml Defines composite action for enumerating workload tests.
.github/actions/enumerate-tests/action.yml Defines composite action for enumerating test projects.
.github/workflows/template-tests.yml & .github/workflows/run-tests.yml Updates workflows to incorporate test matrix generation and execution.
tests/Aspire.Workload.Tests/StarterTemplateProjectNamesTests.cs Refactors the test class to be abstract and updates test data generation.
tests/Aspire.Workload.Tests/StarterTemplateWithRedisCacheTests.cs & related PreviousTFM file Adds SSL certificate requirement; note potential naming duplication.

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

tests/Aspire.Workload.Tests/StarterTemplateWithRedisCacheTests.cs:9

  • [nitpick] The class name 'StarterTemplateWithWithRedisCacheTests' contains a duplicated 'With'. Consider renaming it to 'StarterTemplateWithRedisCacheTests' for clarity.
[RequiresDocker("Needs docker to start redis cache")]
[RequiresSSLCertificate]
public class StarterTemplateWithWithRedisCacheTests : StarterTemplateRunTestsBase<StarterTemplateWithRedisCacheFixture>

tests/Aspire.Workload.Tests/StarterTemplateWithWithRedisCacheTests_PreviousTFM.cs:9

  • [nitpick] The class name 'StarterTemplateWithWithRedisCacheTests_PreviousTFM' includes a duplicated 'With'. Consider renaming it to 'StarterTemplateWithRedisCacheTests_PreviousTFM' to eliminate redundancy.
[RequiresDocker("Needs docker to start redis cache")]
[RequiresSSLCertificate]
public class StarterTemplateWithWithRedisCacheTests_PreviousTFM : StarterTemplateRunTestsBase<StarterTemplateWithRedisCacheFixture_PreviousTFM>

@radical radical requested a review from davidfowl March 11, 2025 04:52
@radical
Copy link
Member Author

radical commented Mar 11, 2025

@eerhardt The Final results job in the Templates workflow will need to be marked as Required too.

@radical
Copy link
Member Author

radical commented Mar 11, 2025

Currently, we build the packages on each of the template test jobs to save time, instead of building once and uploading+downloading in the test jobs.

@radical radical mentioned this pull request Mar 6, 2025
8 tasks
@radical
Copy link
Member Author

radical commented Mar 11, 2025

We can explore using https://github.com/actions/cache in a follow-up.

}
}

// Individual class for each test framework so the tests can run in separate helix jobs
Copy link
Member

Choose a reason for hiding this comment

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

Why are these split, but BuildAndRunTemplateTests aren't?

Copy link
Member Author

Choose a reason for hiding this comment

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

These had a natural split based on the template argument for the test type. I can split the others in a follow up based on how long they take to run. But that timing will be affected once we start using the actions/cache.

Comment on lines +48 to +49
testSessionTimeoutMs: 1200000
testHangTimeout: 12m
Copy link
Member

Choose a reason for hiding this comment

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

With a 20 minute session timeout, is having 12 minute timeout for each test too much?

Copy link
Member Author

Choose a reason for hiding this comment

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

Some tests do multiple builds, and runs of the project. I was using a 7m timeout earlier, but because of those tests I had to bump it.

Comment on lines +14 to +15
# Duplicated jobs so their dependencies are not blocked on both the
# setup jobs
Copy link
Member

Choose a reason for hiding this comment

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

do the setup jobs take long enough to justify this duplication? how long are we talking about?

Copy link
Member Author

Choose a reason for hiding this comment

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

On some runs (yesterday for example) it was 40s vs 4m.

Copy link
Member

Choose a reason for hiding this comment

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

4 minutes to gather which tests to run??

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it was nuget restore taking time essentially.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I wonder if splitting this is actually going to help or hurt, since now it is 2 machines doing the restore instead of 1.

@radical
Copy link
Member Author

radical commented Mar 11, 2025

The failing test is unrelated - #8013 . Re-running that.

@radical radical enabled auto-merge (squash) March 11, 2025 19:35
@radical radical mentioned this pull request Mar 11, 2025
15 tasks
@radical radical disabled auto-merge March 11, 2025 19:44
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.

Let's get this in so these tests are protected. We can make fix ups if necessary afterwards.

@radical radical merged commit b092b22 into dotnet:main Mar 11, 2025
160 checks passed
@radical radical deleted the re-enable-workload-tests branch March 11, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Test] Re-enable Workload tests on PR runs
3 participants