Skip to main content

Module mocks

Module mocks 

Source
Expand description

Mock implementations of runtime primitives for testing.

Structs§

Channel
A mock channel struct that is used internally by Sink and Stream.
DeferredSync
A sync deferred by a DelayedSyncBlob, held open until explicitly completed.
DelayedSyncBlob
Blob wrapper that parks each started sync and supports one-shot blocking sync tracking.
DelayedSyncContext
Context wrapper whose blobs defer Blob::start_sync and can gate blocking syncs in tests.
MutationFaultBlob
Blob wrapper whose mutating operations fail once its MutationFaults allows no more.
MutationFaultContext
Context wrapper whose mutating storage operations fail or park once the shared MutationFaults has let its allowed number succeed. Such an operation never reaches the wrapped storage.
MutationFaults
Controls a MutationFaultContext: after a set number of mutating operations succeed, every later one fails with an injected error or never completes.
PendingSyncs
Coordinates durability operations for a DelayedSyncContext or DelayedSyncBlob.
Sink
A mock sink that implements the Sink trait.
Stream
A mock stream that implements the Stream trait.
SyncFaultBlob
Blob wrapper that fails sync and start_sync when marked faulty.
SyncFaultContext
Context wrapper whose blobs fail sync and start_sync for a single partition.
WriteFaultBlob
Blob wrapper that fails write_at while its WriteFaults is armed.
WriteFaultContext
Context wrapper whose blobs fail write_at while the shared WriteFaults is armed, counting successful writes. Unlike DelayedSyncContext, this injects failures into inline writes issued before any blob sync starts.
WriteFaults
Controls a WriteFaultContext: while armed, every write_at fails with an injected error. Successful writes are counted.

Functions§

drive_pending_syncs
Drive fut to completion, releasing any parked syncs each time it stalls.
fail_pending_syncs
Fail all pending syncs with an injected I/O error.
next_pending_sync
Take the oldest pending sync, panicking if none was started.
release_next_pending_syncs
Complete the oldest count pending syncs successfully.
release_pending_syncs
Complete all pending syncs successfully.