Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chunk ¶
func Chunk(base wasi.System) wasi.System
Chunk wraps the base system to return one that chunks reads and writes to only partially use the I/O vectors. The intent is to exercise paths that handle successful but partial completion of I/O operations.
This fault injector has a side effect of increasing latency of I/O operations because it breaks down the buffering layers that are usually implemented in applications, which may cause measurable slow downs if triggered too often.
The filter does not apply to datagram sockets because truncating messages may break network protocols such as DNS, and the intent of this wrapper is not to inject irrecoverable errors.
func ClockDrift ¶
func ClockDrift(base wasi.System) wasi.System
ClockDrift wraps the base system to return one where the clock is drifting by a random factor.
func Error ¶
func Error(base wasi.System) wasi.System
Error wraps the base system to return one that errors on almost all method calls.
The error returned may vary depending on the method, most will return EIO, ENOBUFS, or ECONNRESET.
Invocations of methods always first call the corresponding method of the base system to so that argument validation is performed before generating errors. This is done so that we don't produce impossible errors such as EIO on an invalid file descriptor number. Note that it means the program cannot assume that an operation succeeded or failed when it gets an error from this system, which is excellent to exercise recovery mechanisms after an error was injected on a write operation.
Errors are not injected in methods that are necessary for a minimal working application such as reading arguments or exiting the program. Injecting errors in those method calls would likely result in uninteresting conditions, like the application not starting at all.
func LowEntropy ¶
func LowEntropy(base wasi.System) wasi.System
LowEntropy constructs a system with a low entropy source for random data generation. The seed data is used to generate random data that is not safe for cryptographic use and will likely cause repeatitions in the pattern of random data exposed to a guest program.
func New ¶
New constructs a new chaos system. The given random source is used for all random number generation. The base system is the fallback when a probability of method invocation did not match any of the rules. The list of rules pairs a probability of being selected when a method of the system is invoked to the system to delegate the invocation to. The systems set on rules are expected to be instances of wrappers created by functions of this package to perform fault injection.