diff options
Diffstat (limited to 'tests/rand_fail.rs')
-rw-r--r-- | tests/rand_fail.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/rand_fail.rs b/tests/rand_fail.rs index 7499694..b4e30ac 100644 --- a/tests/rand_fail.rs +++ b/tests/rand_fail.rs @@ -1,11 +1,11 @@ #[cfg(test)] extern crate growthring; -use growthring::wal::{WALLoader, WALWriter, WALRingId, WALBytes}; +use growthring::wal::{WALLoader, WALWriter, WALStore, WALRingId, WALBytes}; mod common; -fn test(records: Vec<String>, wal: &mut WALWriter<common::WALStoreEmul>) -> Box<[WALRingId]> { +fn test<S: WALStore>(records: Vec<String>, wal: &mut WALWriter<S>) -> Box<[WALRingId]> { let records: Vec<WALBytes> = records.into_iter().map(|s| s.into_bytes().into_boxed_slice()).collect(); let ret = wal.grow(&records).unwrap(); for ring_id in ret.iter() { @@ -16,10 +16,11 @@ fn test(records: Vec<String>, wal: &mut WALWriter<common::WALStoreEmul>) -> Box< #[test] fn test_rand_fail() { + let fgen = common::SingleFailGen::new(100); let mut state = common::WALStoreEmulState::new(); - let mut wal = WALLoader::new(common::WALStoreEmul::new(&mut state), 9, 8, 1000).recover().unwrap(); + let mut wal = WALLoader::new(common::WALStoreEmul::new(&mut state, fgen), 9, 8, 1000).recover().unwrap(); for _ in 0..3 { test(["hi", "hello", "lol"].iter().map(|s| s.to_string()).collect::<Vec<String>>(), &mut wal); } - let mut wal = WALLoader::new(common::WALStoreEmul::new(&mut state), 9, 8, 1000).recover().unwrap(); + WALLoader::new(common::WALStoreEmul::new(&mut state, common::ZeroFailGen), 9, 8, 1000).recover().unwrap(); } |