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