]>
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; | |
d59f1fa8 | 7 | |
6269a49c DM |
8 | use JSON; |
9 | ||
10 | use lib ('.', '../..'); | |
11 | ||
6269a49c | 12 | use Test::MockModule; |
d59f1fa8 TL |
13 | use Test::More; |
14 | ||
6269a49c | 15 | use ReplicationTestEnv; |
810c6776 | 16 | use PVE::API2::Replication; |
6269a49c | 17 | |
6269a49c DM |
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 | ||
810c6776 | 46 | eval { PVE::API2::Replication::run_single_job('job_900_to_node1', 1000); }; |
6269a49c DM |
47 | my $err = $@; |
48 | ||
49 | is($err, "unable to sync to local node\n", "test error message"); | |
50 | ||
51 | done_testing(); |