Don't run integration tests in release jobs#7568
Conversation
Add solution filters (TestFx.NoIntegrationTests.slnf and NonWindowsTests.NoIntegrationTests.slnf) that exclude integration test projects and their test assets. Modify azure-pipelines.yml to use ExcludeIntegrationTests property and the new solution filters for Release matrix entries, so that integration tests are only built and run under Debug jobs. Update eng/Build.props to select the appropriate solution filter based on the ExcludeIntegrationTests property. Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
|
@copilot Publish integration tests binlogs step fails on release for all OSes as we don't run the tests |
… excluded The 'Copy binlogs' and 'Publish integration tests binlogs' steps fail on Release jobs because the testsuite binlog directory doesn't exist when integration tests are excluded. Add condition to only run these steps when _ExcludeIntegrationTests is 'false' (Debug builds). Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Fixed in ecc4627. Added |
|
@copilot can you please do a different PR where you explore doing the same functional fix but not by creating more slnf but instead by updating the dotnet test command to use: Filters test modules using file globbing in .NET. Only tests belonging to those test modules will run. For more information and examples on how to use file globbing in .NET, see File globbing. More info at https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test-mtp |
I'm unable to create new PRs — I can only work within the current PR branch. Would you like me to rework this PR to use the |
|
@copilot ok let's reword this PR then |
… tests in Release Replace the solution filter approach with dotnet test --test-modules glob pattern. For Release builds, runs only unit test modules via: --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.dll" For Debug builds, keeps original test commands unchanged. Removes TestFx.NoIntegrationTests.slnf and NonWindowsTests.NoIntegrationTests.slnf. Reverts eng/Build.props to original (no ExcludeIntegrationTests logic needed). Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Reworked in c6ff763. Replaced the
|
|
@Youssef1313 I was reviewing the tests and I wonder if we should only skip acceptance tests but still run the other integration tests (specifically for MSTest). |
There was a problem hiding this comment.
Pull request overview
Updates the unofficial CI pipeline to avoid running integration tests in Release matrix legs (keeping them in Debug only), reducing redundant work while still running unit test coverage.
Changes:
- Conditioned existing
dotnet teststeps to run only forDebug. - Added
dotnet test --test-modulesinReleaseto execute only unit test assemblies fromartifacts/bin/.... - Conditioned integration-test binlog copy/publish steps to run only for
Debugon Windows/Linux/macOS jobs.
nohwnd
left a comment
There was a problem hiding this comment.
I've spent a minute figuring out why you run the tests twice, hardcoding the config into the paths would make it much easier to see that one step is for debug and other is for release, or at least moving the condition up.
Also do you need to run debug tests at all ?
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…on-tests-redundancy # Conflicts: # azure-pipelines.yml
In Release mode, if the build fails before the test step runs, the TestResults directory won't exist and the publish step would add a misleading failure. Adding continueOnError: true prevents this from failing the build.
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (4)
azure-pipelines.yml:304
continueOnError: trueon publishing the Test Results artifact can mask failures to upload results/logs, making CI issues harder to diagnose. If not explicitly desired, consider removing this so artifact publish failures surface as job failures.
continueOnError: true
azure-pipelines.yml:219
- The Release-only
dotnet test --test-modulescommand is missing--no-build. Because the precedingcibuild.shalready produced the test binaries, adding--no-buildwould avoid redundant compilation and keep behavior aligned with the Debug test step.
- script: dotnet test --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.dll" --results-directory $(BUILD.SOURCESDIRECTORY)/artifacts/TestResults/$(_BuildConfig) --no-progress --output detailed
azure-pipelines.yml:289
- The Release-only
dotnet test --test-modulesstep doesn’t include--no-build. Since the build step already ran for this config, consider adding--no-buildto prevent an extra build/evaluation pass and to keep Debug/Release behavior consistent.
- script: dotnet test --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.dll" --results-directory $(BUILD.SOURCESDIRECTORY)/artifacts/TestResults/$(_BuildConfig) --no-progress --output detailed
azure-pipelines.yml:234
continueOnError: trueon the Test Results artifact publish step means the pipeline can pass even if test results fail to upload, reducing observability for CI failures. Unless this is a deliberate reliability tradeoff, consider removingcontinueOnErrorhere.
continueOnError: true
- Files reviewed: 1/1 changed files
- Comments generated: 2
…OnError - Add --no-build to all three Release dotnet test --test-modules commands to avoid unnecessary rebuilds (Windows, Linux, macOS) - Remove continueOnError: true from Publish Test Results steps to avoid masking real infrastructure failures
--test-modules only accepts a single argument. Use *.exe glob which covers both net4x (native exe) and net8+/net9+ (apphost exe) outputs. Linux/macOS already use a single --test-modules with *.dll pattern.
Integration tests spawn child processes and run
dotnet buildinternally (already covering both Debug and Release configurations). Running them under both Debug/Release CI matrix entries is redundant—only the test project itself gets rebuilt, not meaningful additional coverage.Changes
azure-pipelines.yml— usesdotnet test --test-moduleswith a glob pattern to run only unit tests in Release builds:dotnet testcommand unchanged (runs all tests including integration)dotnet test --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.dll"to run only unit test modules, skipping integration testseq(variables._BuildConfig, 'Debug')so they're skipped in ReleaseNo solution filters or
eng/Build.propschanges are needed—the build always compiles the full solution. On Linux/Mac, only DLLs built fromNonWindowsTests.slnfexist inartifacts/bin/, so the glob pattern naturally excludes Windows-only tests as well.The official pipeline (
azure-pipelines-official.yml) is not affected—its Release builds continue running integration tests as the sole configuration.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.