fix tests when one has iscsi devices
the test would read the real device and if one is an iscsi device it would fail, move the test code to a sub and mock it in the tests Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
3add8714a9
commit
eebcdb1119
@ -80,6 +80,10 @@ sub mocked_get_sysdir_info {
|
||||
return &$originalsub($param);
|
||||
}
|
||||
|
||||
sub mocked_is_iscsi {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub mocked_dir_glob_foreach {
|
||||
my ($dir, $regex, $sub) = @_;
|
||||
|
||||
@ -186,6 +190,8 @@ $diskmanage_module->mock('dir_glob_foreach' => \&mocked_dir_glob_foreach);
|
||||
print("\tMocked dir_glob_foreach\n");
|
||||
$diskmanage_module->mock('get_sysdir_info' => \&mocked_get_sysdir_info);
|
||||
print("\tMocked get_sysdir_info\n");
|
||||
$diskmanage_module->mock('is_iscsi' => \&mocked_is_iscsi);
|
||||
print("\tMocked is_iscsi\n");
|
||||
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
|
||||
print("\tMocked assert_blockdev\n");
|
||||
$diskmanage_module->mock('dir_is_empty' => sub {
|
||||
|
||||
Reference in New Issue
Block a user