[pve-devel] [PATCH storage v2 4/4] tests: test get_disks single/multi disk filter
Dominik Csapak
d.csapak at proxmox.com
Tue Jun 4 12:35:24 CEST 2019
this executes all tests again with each disk as a single parameter
and all disks again as an array ref
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v2
test/disklist_test.pm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/disklist_test.pm b/test/disklist_test.pm
index d9781ee..527e882 100644
--- a/test/disklist_test.pm
+++ b/test/disklist_test.pm
@@ -172,7 +172,29 @@ sub test_disk_list {
$testcount++;
ok(0, "could not parse expected smart for '$disk'\n");
}
+ my $disk_tmp = {};
+
+ # test single disk parameter
+ $disk_tmp = PVE::Diskmanage::get_disks($disk);
+ warn $@ if $@;
+ $testcount++;
+ print Dumper $disk_tmp if $print;
+ is_deeply($disk_tmp->{$disk}, $expected_disk_list->{$disk}, "disk $disk should be the same");
+
+
+ # test wrong parameter
+ eval {
+ PVE::Diskmanage::get_disks( { test => 1 } );
+ };
+ my $err = $@;
+ $testcount++;
+ is_deeply($err, "disks is not a string or array reference\n", "error message should be the same");
+
}
+ # test multi disk parameter
+ $disks = PVE::Diskmanage::get_disks( [ keys %$disks ] );
+ $testcount++;
+ is_deeply($disks, $expected_disk_list, 'disk list should be the same');
done_testing($testcount);
};
--
2.11.0
More information about the pve-devel
mailing list