]>
Commit | Line | Data |
---|---|---|
6269a49c DM |
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 | use JSON; | |
8 | ||
9 | use lib ('.', '../..'); | |
10 | ||
11 | use Data::Dumper; | |
12 | ||
13 | use Test::MockModule; | |
14 | use ReplicationTestEnv; | |
15 | ||
16 | use Test::More; | |
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::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(); |