]> git.proxmox.com Git - pve-manager.git/blob - test/replication_test3.pl
ui: lvm: expose saferemove setting
[pve-manager.git] / test / replication_test3.pl
1 #!/usr/bin/perl
2
3 # Note: Try to run replication job to same node (should fail)
4
5 use strict;
6 use warnings;
7
8 use JSON;
9
10 use lib ('.', '../..');
11
12 use Test::MockModule;
13 use Test::More;
14
15 use ReplicationTestEnv;
16 use PVE::API2::Replication;
17
18 $ReplicationTestEnv::mocked_nodename = 'node1';
19
20 my $testjob = {
21 'type' => 'local',
22 'target' => 'node1',
23 'guest' => 900,
24 };
25
26 $ReplicationTestEnv::mocked_replication_jobs = {
27 job_900_to_node1 => {
28 'type' => 'local',
29 'target' => 'node1', # local node, job should be skipped
30 'guest' => 900,
31 },
32 };
33
34 $ReplicationTestEnv::mocked_vm_configs = {
35 900 => {
36 node => 'node1',
37 snapshots => {},
38 ide0 => 'local-lvm:vm-900-disk-1,size=4G',
39 memory => 512,
40 ide2 => 'none,media=cdrom',
41 },
42 };
43
44 ReplicationTestEnv::setup();
45
46 eval { PVE::API2::Replication::run_single_job('job_900_to_node1', 1000); };
47 my $err = $@;
48
49 is($err, "unable to sync to local node\n", "test error message");
50
51 done_testing();