Use writable copies for LocalDB tests - #7672
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6dd6e79f-ff2e-4596-ae45-1c842d45bd40
Copy packaged database files to a per-test temporary directory before attaching them so newer LocalDB versions can upgrade the files on Windows CI agents. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6dd6e79f-ff2e-4596-ae45-1c842d45bd40
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Drop each per-test database and remove its temporary files after the test, while logging cleanup failures without masking test results. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6dd6e79f-ff2e-4596-ae45-1c842d45bd40
There was a problem hiding this comment.
Pull request overview
This PR updates the DatabaseLoaderTests LocalDB setup to avoid CI failures caused by the packaged .mdf/.ldf files being attached read-only on some Windows images. It does this by copying the database files to a per-test temp location, clearing read-only attributes, using a unique database name per test, and attempting best-effort cleanup afterward.
Changes:
- Copy
TestDatabasesLocalDB.mdf/.ldffiles into a per-test temporary directory and make them writable before attaching. - Attach LocalDB using a unique database name per test run to prevent collisions.
- Add test cleanup logic to drop the temporary LocalDB database and delete the temporary directory (logging failures).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7672 +/- ##
==========================================
+ Coverage 69.59% 69.75% +0.16%
==========================================
Files 1484 1486 +2
Lines 273606 275790 +2184
Branches 27949 28199 +250
==========================================
+ Hits 190410 192375 +1965
- Misses 75832 75953 +121
- Partials 7364 7462 +98
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Clear System.Data.SqlClient pools even when dropping a temporary test database fails, while preserving narrow cleanup exception handling. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6dd6e79f-ff2e-4596-ae45-1c842d45bd40
|
/ba-g failures are unrelate to this PR and will be addressed as follow up |
Fixes #7657.
Summary
System.Data.SqlClientconnection pools, including when dropping the database fails.