zpool_list: add tests for special pool names

those names are allowed for zpools

these will fail for now, but it will be fixed in the next commit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-07-08 14:59:16 +02:00 committed by Dietmar Maurer
parent 7957fabff2
commit c3a4b5e2e1
1 changed files with 28 additions and 2 deletions

View File

@ -221,7 +221,7 @@ logs
assert_eq!(data, expect); assert_eq!(data, expect);
let output = "\ let output = "\
btest 427349245952 761856 427348484096 - - 0 0 1.00 ONLINE - b-test 427349245952 761856 427348484096 - - 0 0 1.00 ONLINE -
mirror 213674622976 438272 213674184704 - - 0 0 - ONLINE mirror 213674622976 438272 213674184704 - - 0 0 - ONLINE
/dev/sda1 - - - - - - - - ONLINE /dev/sda1 - - - - - - - - ONLINE
/dev/sda2 - - - - - - - - ONLINE /dev/sda2 - - - - - - - - ONLINE
@ -235,7 +235,7 @@ logs - - - - - - - - -
let data = parse_zpool_list(&output)?; let data = parse_zpool_list(&output)?;
let expect = vec![ let expect = vec![
ZFSPoolInfo { ZFSPoolInfo {
name: String::from("btest"), name: String::from("b-test"),
health: String::from("ONLINE"), health: String::from("ONLINE"),
usage: Some(ZFSPoolUsage { usage: Some(ZFSPoolUsage {
size: 427349245952, size: 427349245952,
@ -261,5 +261,31 @@ logs - - - - - - - - -
assert_eq!(data, expect); assert_eq!(data, expect);
let output = "\
b.test 427349245952 761856 427348484096 - - 0 0 1.00 ONLINE -
mirror 213674622976 438272 213674184704 - - 0 0 - ONLINE
/dev/sda1 - - - - - - - - ONLINE
";
let data = parse_zpool_list(&output)?;
let expect = vec![
ZFSPoolInfo {
name: String::from("b.test"),
health: String::from("ONLINE"),
usage: Some(ZFSPoolUsage {
size: 427349245952,
alloc: 761856,
free: 427348484096,
dedup: 1.0,
frag: 0,
}),
devices: vec![
String::from("/dev/sda1"),
]
},
];
assert_eq!(data, expect);
Ok(()) Ok(())
} }