-
Notifications
You must be signed in to change notification settings - Fork 321
Separate Unit and Integration Test Runs #3907
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This pull request optimizes CI/CD pipeline execution by separating unit and integration tests to reduce redundant test execution. The PR introduces a testType parameter that controls which test suites run in different pipeline contexts.
Changes:
- Added
testTypeparameter ('All', 'Unit', or 'Integration') to pipeline templates - Modified PR pipelines to run only relevant test suites (Unit tests in Project builds, Integration tests in Package builds)
- Updated test execution conditionals to respect the new testType parameter
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| eng/pipelines/sqlclient-pr-project-ref-pipeline.yml | Sets testType to 'Unit' for project reference builds, restricting to unit and functional tests |
| eng/pipelines/sqlclient-pr-package-ref-pipeline.yml | Sets testType to 'Integration' for package reference builds, restricting to manual tests |
| eng/pipelines/dotnet-sqlclient-ci-core.yml | Defines testType parameter with default 'All' for CI pipelines to continue running all tests |
| eng/pipelines/common/templates/steps/run-all-tests-step.yml | Implements conditional test execution based on testType parameter |
| eng/pipelines/common/templates/stages/ci-run-tests-stage.yml | Propagates testType parameter through stage template |
| eng/pipelines/common/templates/jobs/ci-run-tests-job.yml | Propagates testType parameter through job template |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #3907 +/- ##
===========================================
- Coverage 74.99% 28.81% -46.19%
===========================================
Files 269 263 -6
Lines 43246 66170 +22924
===========================================
- Hits 32433 19064 -13369
- Misses 10813 47106 +36293
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
benrr101
left a comment
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.
Overall, probably a good change. The main issue I have right now is the lumping of functional tests with unit tests. My understanding of them were that they were not unit tests in theory, they were just the simple integration tests that validate they do the most basic stuff. As it turns out a lot of those are unit tests, but not the majority. I was working on the side a bit to move the unit tests from the functional tests and into the unit test project. Ultimately I think we're aligned that we want: unit test, local integration test, remote integration test, stress test, and fuzz test projects. And this change is kinda orthogonal to those goals, without getting in the way of them. So go for it 😆
I think another low-ish hanging fruit is to separate the unit tests and functional tests as separate jobs, like the test sets. That way we don't need to repeat unit and functional tests four times for each platform. They're fast, yes, but not instantaneous, and I imagine we could shave a decent amount of time off a build doing it.
|
You're correct on all counts. I chose to combine the running of Unit and Functional tests because they're mostly unit with some local integration sprinkled in, but mainly because their combined run time is close to the Manual ones. This gives us the most bang-for-the-buck in terms of speeding up the PR runs right now. We also shouldn't be running Unit and Functional tests in any of the Azure SQL configurations - another future optimization. |
|
|
||
| # Include the code coverage job if the build type is Project. | ||
| ${{ if eq(parameters.buildType, 'Project') }}: | ||
| # Include the code coverage job under certain circumstances: |
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 continue to publish code coverage the same as we did before the split... for now. This is fragile and we should re-think how/when/why to publish coverage as we re-write these pipelines.
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.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
priyankatiwari08
left a comment
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.
Looks good to me. Manual tests in itself takes quite significant amount of time to run. So, this segregation should help us in longer run.
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.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
- Project runs will perform unit tests (i.e. MDS Unit and Functional suites). - Package runs will perform integration tests (i.e. MDS Manual suite).
190fcb7 to
523250b
Compare
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.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
- Use a temp dir to avoid cluttering up the pooled agents. - Combine all merging/converting into a few files as possible. - Use the modern features of the dotnet tools to avoid parallel jobs and loops. - Combined all MDS reports into a single upload, and same for AKV.
| - template: common/templates/jobs/ci-code-coverage-job.yml@self | ||
| parameters: | ||
| debug: ${{ parameters.debug }} | ||
| # TODO: Forcing debug temporarily for PR runs. |
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.
@paulmedynski Address this TODO.
| # buildType don't add much, if any, value to the coverage reports. | ||
| # They have not been configured with suitable CodeCov credentials to | ||
| # perform the upload. | ||
| # Other pipelines that share this template buildType don't add much, |
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.
@paulmedynski Fix this jibberish.
| variables: | ||
| netFxDir: $(Build.SourcesDirectory)\coverageNetFx | ||
| netCoreDir: $(Build.SourcesDirectory)\coverageNetCore | ||
| # Use a temp directory that is cleaned up after each job runs. This helps |
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.
I will run the pipeline in debug mode to make sure this temp dir lives on a partition/mount with sufficient space.
| ${{ else }}: | ||
| targetPath: $(netCoreDir) | ||
| # Download all of the coverage reports from the test jobs. |
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.
I greatly simplified things here. The old tasks went out of their way to separate the MDS .NET and .NET Framework coverage and reports. Now that we've merged the codebases, I can't see why we would care about that. So the new approach is to merge all of the test results together, generate Cobertura reports for MDS and AKV, and then upload them as separate entities. Thoughts?
Motivation
Our PR pipelines are taking too long to run, for many reasons that we can't fix all at once. The low hanging fruit right now is that we are running all MDS tests twice - once in the Project pipeline, and once in the Package pipeline. This is unnecessary, so we're splitting things up:
Reasoning
Testing
PR pipeline runs will confirm that tests are still passing. I will manually verify that the expected types of tests are running in the designated pipelines.