]> git.proxmox.com Git - pve-manager.git/blame - bin/test/replication_test3.pl
PVE::Replication - pass guest_class to run_replication
[pve-manager.git] / bin / test / replication_test3.pl
CommitLineData
6269a49c
DM
1#!/usr/bin/perl
2
3# Note: Try to run replication job to same node (should fail)
4
5use strict;
6use warnings;
7use JSON;
8
9use lib ('.', '../..');
10
11use Data::Dumper;
12
13use Test::MockModule;
14use ReplicationTestEnv;
15
16use Test::More;
17
18$ReplicationTestEnv::mocked_nodename = 'node1';
19
20my $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
44ReplicationTestEnv::setup();
45
46eval { PVE::Replication::run_single_job('job_900_to_node1', 1000); };
47my $err = $@;
48
49is($err, "unable to sync to local node\n", "test error message");
50
51done_testing();