diff options
author | Robert Ignat <robert.ignat91@gmail.com> | 2017-06-25 16:57:48 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-07-13 18:24:20 +0200 |
commit | 94928c33ca461e1e046e027070b79cc6023c49a6 (patch) | |
tree | 28e2b95974bff9fd000f20e106c489f37a7e7f54 | |
parent | b0a5e1727e7884fc13d16692d659bb5deb1da0be (diff) |
Use inmemory file system for imag-link tests
-rw-r--r-- | imag-link/src/main.rs | 4 | ||||
-rw-r--r-- | libimagrt/src/configuration.rs | 4 | ||||
-rw-r--r-- | libimagrt/src/runtime.rs | 12 |
3 files changed, 18 insertions, 2 deletions
diff --git a/imag-link/src/main.rs b/imag-link/src/main.rs index 8e9bdf0f..a1c19f06 100644 --- a/imag-link/src/main.rs +++ b/imag-link/src/main.rs @@ -393,6 +393,10 @@ version = \"0.3.0\"\ fn enable_logging(&self) -> bool { false } + + fn use_inmemory_fs(&self) -> bool { + true + } } fn generate_test_config() -> Option<Configuration> { diff --git a/libimagrt/src/configuration.rs b/libimagrt/src/configuration.rs index 15e54356..c14063bd 100644 --- a/libimagrt/src/configuration.rs +++ b/libimagrt/src/configuration.rs @@ -289,6 +289,10 @@ pub trait InternalConfiguration { fn enable_logging(&self) -> bool { true } + + fn use_inmemory_fs(&self) -> bool { + false + } } impl<'a> InternalConfiguration for App<'a, 'a> {} diff --git a/libimagrt/src/runtime.rs b/libimagrt/src/runtime.rs index 3907a60a..2e3f32d7 100644 --- a/libimagrt/src/runtime.rs +++ b/libimagrt/src/runtime.rs @@ -35,7 +35,7 @@ use error::RuntimeErrorKind; use error::MapErrInto; use logger::ImagLogger; -use libimagstore::store::Store; +use libimagstore::store::{Store, InMemoryFileAbstraction}; use spec::CliSpec; /// The Runtime object @@ -150,7 +150,15 @@ impl<'a> Runtime<'a> { write!(stderr(), "Store-config: {:?}\n", store_config).ok(); } - Store::new(storepath, store_config).map(|store| { + let store_result = if cli_app.use_inmemory_fs() { + Store::new_with_backend(storepath, + store_config, + Box::new(InMemoryFileAbstraction::new())) + } else { + Store::new(storepath, store_config) + }; + + store_result.map(|store| { Runtime { cli_matches: matches, configuration: config, |