test: mock calls that can fail in a chroot environment

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Fiona Ebner 2023-05-19 11:49:15 +02:00 committed by Thomas Lamprecht
parent e4263214b8
commit da8fc2f2ad

View File

@ -61,6 +61,13 @@ my $mocked_cfs_read_file = sub {
# mocked modules
our $cgroup_module = Test::MockModule->new("PVE::CGroup");
$cgroup_module->mock(
cgroup_mode => sub {
return 2;
},
);
our $cluster_module = Test::MockModule->new("PVE::Cluster");
$cluster_module->mock(
cfs_read_file => $mocked_cfs_read_file,
@ -133,6 +140,12 @@ $replication_config_module->mock(
cfs_read_file => $mocked_cfs_read_file,
);
our $safe_syslog_module = Test::MockModule->new("PVE::SafeSyslog");
$safe_syslog_module->mock(
initlog => sub {},
syslog => sub {},
);
our $storage_module = Test::MockModule->new("PVE::Storage");
$storage_module->mock(
activate_volumes => sub {