Skip to main content

power_cut_suite

Function power_cut_suite 

Source
pub fn power_cut_suite(rig: &mut dyn PowerCutRig)
Expand description

Cuts the power in a write over an old value, a first write and a delete, after each number of operations of the medium in turn, until the operation finishes, and checks what the storage reads after each restart. Panics with the promise broken, the operation and the cut.

The promises:

  1. a write over an old value reads the old value or the new one: never None, a mix or an error;
  2. a first write reads None or the new value;
  3. a delete reads the old value or None;
  4. a write or delete that returned Ok reads its result after the restart (the restart is a power cut too);
  5. another key, written once at the start, reads the same after every restart;
  6. list() names exactly the keys that read Some;
  7. with the power on, a write after the cut works and reads back.

An operation that needs more than 10 000 operations of the medium fails the suite.