Skip to content

Commit

Permalink
zfs-core: fix tests for openzfs 2.0 on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
codyps committed Aug 4, 2021
1 parent 9d8b554 commit 1f3a0e3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions zfs-core/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,11 @@ fn hold_not_snap() {
// variant. This might be a bug in our code, or some change in how lzc handles errors for
// single results
match e {
// zfs 2.0.0 on linux:
#[cfg(target_os = "linux")]
// openzfs 2.0.0:
zfs_core::Error::Io { source: e } => {
assert_eq!(e.kind(), io::ErrorKind::InvalidInput);
}
// zfs 1.9.4 on macos:
#[cfg(target_os = "macos")]
// openzfs 1.9.4:
zfs_core::Error::List { source: el } => {
let mut hm = std::collections::HashMap::new();
hm.insert(tmpfs.path().to_owned() + "/2", io::ErrorKind::InvalidInput);
Expand All @@ -336,10 +334,6 @@ fn hold_not_snap() {
}
}
}

_ => {
panic!("unexpected error kind: {:?}", e);
}
}
}

Expand All @@ -364,13 +358,14 @@ fn hold_not_exist() {
e
} else {
// macos hits this for some reason
/*
#[cfg(target_os = "macos")]
{
eprintln!("macos zfs 1.9.4 is for some reason totally cool with creating holds on non-existent snaps");
return;
}
*/

#[cfg(not(target_os = "macos"))]
panic!("expected an error, got {:?}", e);
};

Expand All @@ -379,7 +374,6 @@ fn hold_not_exist() {
// linux (zfs 2.0.0) doesn't appear to return our error list, which is also concerning
match e {
// zfs 2.0.0 on linux:
#[cfg(target_os = "linux")]
zfs_core::Error::Io { source: e } => {
assert_eq!(e.kind(), io::ErrorKind::NotFound);
}
Expand Down

0 comments on commit 1f3a0e3

Please sign in to comment.