aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-03-18 16:15:32 -0500
committerToby Vincent <tobyv13@gmail.com>2022-03-18 16:15:32 -0500
commit746b7a438d5a61a31bfa60f9310b502dc0e980af (patch)
treea486fdda115015dcef54af460da9894138a41862
parent0074718ecdb2f576f8c17c112e576168b392ea0e (diff)
fix: only run zfs test if zfs exists
-rw-r--r--Cargo.lock12
-rw-r--r--zone_zfs/Cargo.toml6
-rw-r--r--zone_zfs/src/zfs.rs6
3 files changed, 22 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index db25267..af501c3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2191,6 +2191,17 @@ dependencies = [
]
[[package]]
+name = "which"
+version = "4.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2"
+dependencies = [
+ "either",
+ "lazy_static",
+ "libc",
+]
+
+[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2289,6 +2300,7 @@ dependencies = [
"serde",
"thiserror",
"tracing",
+ "which",
]
[[package]]
diff --git a/zone_zfs/Cargo.toml b/zone_zfs/Cargo.toml
index 241710a..197384a 100644
--- a/zone_zfs/Cargo.toml
+++ b/zone_zfs/Cargo.toml
@@ -8,9 +8,13 @@ edition = "2021"
byte-unit = { version = "4.0.13", features = ["serde"], default-features = false }
chrono = { version = "0.4.19", optional = true }
derive_builder = "0.10.2"
-figment = { version = "0.10.6", features = ["toml", "env", "test"] }
+figment = { version = "0.10.6", features = ["toml", "env"] }
serde = { version = "1.0.136", features = ["derive"] }
thiserror = "1.0.30"
tracing = "0.1.29"
+[dev-dependencies]
+which = "4.2.4"
+figment = { version = "*", features = ["test"] }
+
[features]
diff --git a/zone_zfs/src/zfs.rs b/zone_zfs/src/zfs.rs
index b24fe3a..70dc98a 100644
--- a/zone_zfs/src/zfs.rs
+++ b/zone_zfs/src/zfs.rs
@@ -69,9 +69,13 @@ impl ZFS {
#[cfg(test)]
mod tests {
+ use which::which;
+
#[test]
fn get_file_systems() {
use super::*;
- assert!(ZFS::new().unwrap().get_file_systems().is_ok());
+ if which("zfs").is_ok() {
+ assert!(ZFS::new().unwrap().get_file_systems().is_ok());
+ }
}
}