]> git.proxmox.com Git - pve-storage.git/commitdiff
tests: test get_disks single/multi disk filter
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 4 Jun 2019 10:35:24 +0000 (12:35 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 4 Jun 2019 10:51:44 +0000 (12:51 +0200)
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@proxmox.com>
test/disklist_test.pm

index d9781ee38fe37b0149528721f894c9b0775342c4..527e882afadee340df227d7652d6e91992e7bef5 100644 (file)
@@ -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);
     };