You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a61e785
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: samples/public/ReliableTestSuite/README.md
+7-11Lines changed: 7 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,8 @@ shared-state bugs. Each file then demonstrates one rung of the reliability ladde
9
9
10
10
| File | Technique | Why it matters |
11
11
| --- | --- | --- |
12
-
|`OrderExportTests.cs`|**Eliminate** — per-test unique temp directory | No shared resource ⇒ no lock needed ⇒ full parallelism. The cheapest concurrency bug is the one that cannot exist. (After the framework package pin moves to MSTest 4.4, `TestContext.TestTempDirectory` can manage this for you.) |
13
-
|`EnvironmentPricingTests.cs`|**Coordinate** — `[DoNotParallelize]` with the pinned MSTest 4.3 packages, `[ResourceLock(WellKnownResources.EnvironmentVariables)]`after upgrading them to 4.4| Genuinely process-global state must be serialized. `[ResourceLock]` serializes *only* the tests that share the named resource, not the whole suite. |
12
+
|`OrderExportTests.cs`|**Eliminate** — per-test unique temp directory | No shared resource ⇒ no lock needed ⇒ full parallelism. The cheapest concurrency bug is the one that cannot exist. (With MSTest 4.4.1, `TestContext.TestTempDirectory` can manage this for you.) |
13
+
|`EnvironmentPricingTests.cs`|**Coordinate** — `[DoNotParallelize]`, with `[ResourceLock(WellKnownResources.EnvironmentVariables)]`as the precise alternative| Genuinely process-global state must be serialized. `[ResourceLock]` serializes *only* the tests that share the named resource, not the whole suite. |
14
14
|`PlatformSpecificTests.cs`|**Gate** — `[OSCondition]`, `[CICondition]`, `[ExecutableCondition]`| A test that silently early-returns on the wrong OS reports a false pass. Conditions report *not run* for the right reason. |
15
15
|`CancellableWorkTests.cs`|**Bound time** — `[Timeout(CooperativeCancellation = true)]` + `TestContext.CancellationToken`| A test that can hang has no place in a reliable suite; cooperative cancellation stops the work cleanly. No `Thread.Sleep`. |
16
16
|`FlakyDependencyTests.cs`|**Contain** — `[Retry]`| Retry makes a nondeterministic test pass more often; it does **not** make it deterministic. Last resort for residual, external flakiness only. |
@@ -27,13 +27,9 @@ resource locks, and only then contain whatever residual nondeterminism you could
27
27
## `[ResourceLock]` note
28
28
29
29
`[ResourceLock]` and `WellKnownResources` ship in the **MSTest 4.4 framework packages**. This sample
30
-
uses `MSTest.Sdk`**4.4.0** from `../global.json`, but `../Directory.Build.props` independently pins
31
-
the MSTest framework and adapter packages to **4.3.2** through `MSTestVersion`. The available APIs
32
-
therefore remain those from MSTest 4.3. The sample demonstrates the coordination step with
33
-
`[DoNotParallelize]` and shows the exact `[ResourceLock]` upgrade in the comments of
34
-
`EnvironmentPricingTests.cs`. Once `MSTestVersion` moves to 4.4 or later, the migration is a
35
-
one-for-one swap: **remove**`[DoNotParallelize]` and **add**`[ResourceLock(...)]` (keeping both
36
-
would just re-serialize the class).
30
+
uses `MSTest.Sdk` and framework packages **4.4.1**. `EnvironmentPricingTests.cs` deliberately keeps
31
+
`[DoNotParallelize]` to demonstrate blanket serialization and shows `[ResourceLock]` as the precise
32
+
alternative in its comments. Switching between them is a one-for-one attribute replacement.
37
33
38
34
`[ResourceLock]` limitations worth stating up front:
39
35
@@ -56,8 +52,8 @@ would just re-serialize the class).
56
52
same seed. To reproduce a race deterministically, reduce parallelism (or serialize the suspects)
57
53
first, then use the seed to pin the order. In CI you should **rotate the seed** (or leave it unset)
58
54
so runs keep exploring new orderings instead of freezing on one.
59
-
- With the framework packages pinned to **MSTest 4.3.x**, a retried-then-passed test reports as an
60
-
ordinary pass. After `MSTestVersion` moves to **4.4+**, it surfaces as *flaky* instead.
55
+
- With the framework packages pinned to **MSTest 4.4.1**, a retried-then-passed test surfaces as
0 commit comments