Skip to content

A FoundationDB style deterministic testing framework for async/await Rust

License

Notifications You must be signed in to change notification settings

xxuejie/diviner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diviner

Diviner is a FoundationDB style simulation testing framework for Rust. It includes 2 parts:

  • A Future executor that is designed to be single threaded and deterministic. The goal here is to enable deterministic simulations in Rust.
  • Wrappers over existing Rust async IO libraries. When building normally, the wrappers will use the actual implementation, but when building with simulation feature enabled, the wrappers will use mocked implementations that integrate with above Future executor to enable deterministic testing. The wrappers mentioned here, might inclue (but are not limited to):
    • Time related functions, such as sleep or now;
    • Network related modules, such as TCPListener, TCPStream;
    • File IO related modules;

If you find the above term confusing, this video might help explain what diviner provides.

The goal here, is to enable deterministic testing on any Rust code satisfying the following rules:

  1. The code is written in async/await style;
  2. The code uses wrappers provided by diviner to perform all the necessary IOs;

Examples

To illustrate what the library does, several examples are provided in the repository:

  • simple: a minimal piece of code written in async/await style;
  • time-manipulation: time manipulation example, here we are testing sleeping for a whole day, but the simulation code would manipulate time and finish immediately;
  • execution-order: a poorly implemented agent, diviner can use different seeds to test different execution orders of futures. So later you can determinisically debug the code with the seed that will trigger the errors;

About

A FoundationDB style deterministic testing framework for async/await Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages