diff options
author | Luca Bruno <lucab@redhat.com> | 2019-07-17 09:51:38 +0000 |
---|---|---|
committer | Paul Masurel <paul.masurel@gmail.com> | 2019-07-17 18:51:38 +0900 |
commit | 4e6dcf3cbe860f68c345ccf05523996fab5d9e61 (patch) | |
tree | 2e5df6d1974036b7249d894b1a02f37c5e723616 | |
parent | af7ea1422a887177b2febf37e5fbdb61e9d499c1 (diff) |
cargo: update to fail 0.3 (#593)
* cargo: update to fail 0.3
* tantivy: align failpoints feature naming
This aligns feature naming to use `failpoints` everywhere, like the
underlying library.
-rw-r--r-- | Cargo.toml | 7 | ||||
-rwxr-xr-x | run-tests.sh | 2 | ||||
-rw-r--r-- | src/indexer/index_writer.rs | 6 |
3 files changed, 7 insertions, 8 deletions
@@ -49,7 +49,7 @@ fnv = "1.0.6" owned-read = "0.4" failure = "0.1" htmlescape = "0.3.1" -fail = "0.2" +fail = "0.3" scoped-pool = "1.0" murmurhash32 = "0.2" chrono = "0.4" @@ -74,11 +74,10 @@ debug-assertions = true overflow-checks = true [features] -# by default no-fail is disabled. We manually enable it when running test. -default = ["mmap", "no_fail"] +default = ["mmap"] mmap = ["atomicwrites", "fs2", "memmap", "notify"] lz4-compression = ["lz4"] -no_fail = ["fail/no_fail"] +failpoints = ["fail/failpoints"] unstable = [] # useful for benches. wasm-bindgen = ["uuid/wasm-bindgen"] diff --git a/run-tests.sh b/run-tests.sh index fc2944d..8f3f934 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,2 +1,2 @@ #!/bin/bash -cargo test --no-default-features --features mmap -- --test-threads 1 +cargo test --features "failpoints" diff --git a/src/indexer/index_writer.rs b/src/indexer/index_writer.rs index fee0731..c642efe 100644 --- a/src/indexer/index_writer.rs +++ b/src/indexer/index_writer.rs @@ -931,6 +931,7 @@ mod tests { #[test] fn test_with_merges() { + let _guard = fail::FailScenario::setup(); let mut schema_builder = schema::Schema::builder(); let text_field = schema_builder.add_text_field("text", schema::TEXT); let index = Index::create_in_ram(schema_builder.build()); @@ -1041,10 +1042,10 @@ mod tests { assert_eq!(num_docs_containing("b"), 100); } - #[cfg(not(feature = "no_fail"))] + #[cfg(feature = "failpoints")] #[test] fn test_write_commit_fails() { - use fail; + let _guard = fail::FailScenario::setup(); let mut schema_builder = schema::Schema::builder(); let text_field = schema_builder.add_text_field("text", schema::TEXT); let index = Index::create_in_ram(schema_builder.build()); @@ -1065,7 +1066,6 @@ mod tests { }; assert_eq!(num_docs_containing("a"), 100); assert_eq!(num_docs_containing("b"), 0); - fail::cfg("RAMDirectory::atomic_write", "off").unwrap(); } #[test] |