FaultySeam
A Seam wrapper that injects configurable faults for use in tests.
Faults are driven by a FaultProfile which can be swapped atomically at any point during a test via setFaultProfile. The profile change takes effect on the next frame — frames already in-flight at the moment of the switch complete under the old profile.
Determinism guarantee: every probabilistic and randomised fault takes an explicit seed. No wall-clock time is consumed — delays go through kotlinx.coroutines.delay so kotlinx.coroutines.test.runTest controls virtual time.
Teardown is a second, orthogonal axis — TeardownFault, swappable via setTeardownFault and defaulting to TeardownFault.None. A FaultProfile describes what happens to frames and is never consulted by close; see TeardownFault's KDoc for why the two are not one hierarchy.
Inspection hooks: framesDropped, framesDelayed, framesDelivered and teardownFaultsFired counters are updated atomically so tests can assert on fault behaviour without inspecting internal channels.
Consumed by partition / reconnect test suites. Exposes the same Seam contract as InMemoryLoom-produced links.
Constructors
Properties
How many times close has selected a non-TeardownFault.None arm — counted at selection, before the arm runs.
Functions
Close the link, applying the active TeardownFault.
Shorthand for setFaultProfile with FaultProfile.Healthy.
Shorthand for setFaultProfile with FaultProfile.DropAll.
Replace the active FaultProfile atomically.
Replace the active TeardownFault atomically.