Skip to content

[CI] Enable Workload tests for PR validation - #7939

Merged
radical merged 15 commits into
microsoft:mainfrom
radical:re-enable-workload-tests
Mar 11, 2025
Merged

[CI] Enable Workload tests for PR validation#7939
radical merged 15 commits into
microsoft:mainfrom
radical:re-enable-workload-tests

Conversation

@radical

@radical radical commented Mar 6, 2025

Copy link
Copy Markdown
Member
  • 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
Copy Markdown
Contributor

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

radical commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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 AI 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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>

Comment thread tests/Aspire.Workload.Tests/StarterTemplateProjectNamesTests.cs Outdated
@radical
radical requested a review from davidfowl March 11, 2025 04:52
@radical

radical commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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

@radical

radical commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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
25 tasks
@radical

radical commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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

Comment thread tests/Aspire.Workload.Tests/StarterTemplateProjectNamesTests.cs Outdated
}
}

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

Copy link
Copy Markdown
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
Copy Markdown
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 thread .github/workflows/template-tests.yml Outdated
Comment on lines +48 to +49
testSessionTimeoutMs: 1200000
testHangTimeout: 12m

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

radical commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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

@eerhardt eerhardt left a comment

Copy link
Copy Markdown
Member

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 microsoft:main Mar 11, 2025
@radical
radical deleted the re-enable-workload-tests branch March 11, 2025 20:00
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 11, 2025
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.

[Test] Re-enable Workload tests on PR runs

4 participants