Fix flaky test - #1401
Conversation
Just assert the instance check does not throw - other tests already implicitly test whether an instance actually exists.
- Remove checking of invalid characters. - Only check that we don't accidentally try and delete the default instance.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1401 +/- ##
===========================================
+ Coverage 56.56% 90.94% +34.37%
===========================================
Files 21 23 +2
Lines 1105 1137 +32
Branches 91 96 +5
===========================================
+ Hits 625 1034 +409
+ Misses 461 78 -383
- Partials 19 25 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky test in the SQL LocalDB test suite and simplifies the fuzz testing validation logic. The main focus is on making tests more reliable by removing unnecessary checks and simplifying test assertions.
- Simplified the
Can_Test_Whether_Instances_Exist()test to only verify the method doesn't throw, as other tests already validate the actual existence checking behavior - Removed complex invalid character validation in fuzz tests, now only checking to avoid deletion of default instances ("v11.0" and "MSSQLLocalDB")
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/SqlLocalDb.Tests/SqlLocalDbApiTests.cs | Simplified the Can_Test_Whether_Instances_Exist() test by removing start/stop instance logic and changing to only assert that calling InstanceExists() doesn't throw |
| tests/SqlLocalDb.FuzzTests/FuzzTests.cs | Removed the InvalidNameChars HashSet and simplified SanitizeInstanceName() to only filter out default instance names instead of checking for invalid characters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Otherwise some characters get through and then cause tests that enumerate and test instances to fail.
Uh oh!
There was an error while loading. Please reload this page.