use PVE::LXC;
use PVE::LXC::Config;
use PVE::Tools;
+use PVE::ReplicationConfig;
use Test::MockModule;
use Test::More;
die "volume_rollback_is_possible failed\n";
}
+sub mocked_vm_stop {
+ if ($kill_possible) {
+ $running = 0;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
sub mocked_run_command {
my ($cmd, %param) = @_;
my $cmdstring;
die "lxc-[un]freeze disabled\n";
}
if ($cmdstring =~ m/.*\/lxc-stop.*--kill.*/) {
- if ($kill_possible) {
- $running = 0;
- return 1;
- } else {
- return 0;
- }
+ mocked_vm_stop();
}
}
die "unexpected run_command call: '$cmdstring', aborting\n";
my $raw = PVE::Tools::file_get_contents($filename);
- my $conf = PVE::LXC::parse_pct_config($filename, $raw);
+ my $conf = PVE::LXC::Config::parse_pct_config($filename, $raw);
return $conf;
}
}
}
- my $raw = PVE::LXC::write_pct_config($filename, $conf);
+ my $raw = PVE::LXC::Config::write_pct_config($filename, $conf);
PVE::Tools::file_set_contents($filename, $raw);
}
my $lxc_module = new Test::MockModule('PVE::LXC');
$lxc_module->mock('sync_container_namespace', sub { return; });
$lxc_module->mock('check_running', \&mocked_check_running);
+$lxc_module->mock('vm_stop', \&mocked_vm_stop);
my $lxc_config_module = new Test::MockModule('PVE::LXC::Config');
$lxc_config_module->mock('config_file_lock', sub { return "snapshot-working/pve-test.lock"; });
$lxc_config_module->mock('write_config', \&mocked_write_config);
$lxc_config_module->mock('has_feature', \&mocked_has_feature);
+# ignore existing replication config
+my $repl_config_module = new Test::MockModule('PVE::ReplicationConfig');
+$repl_config_module->mock('check_for_existing_jobs' => sub { return undef });
+
$running = 1;
$freeze_possible = 1;