]> git.proxmox.com Git - pve-manager.git/blame - bin/test/replication_test3.pl
PVE::Replication - remove dependency to PVE::LXC/PVE::QemuServer
[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;
810c6776 15use PVE::API2::Replication;
6269a49c
DM
16
17use Test::More;
18
19$ReplicationTestEnv::mocked_nodename = 'node1';
20
21my $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
45ReplicationTestEnv::setup();
46
810c6776 47eval { PVE::API2::Replication::run_single_job('job_900_to_node1', 1000); };
6269a49c
DM
48my $err = $@;
49
50is($err, "unable to sync to local node\n", "test error message");
51
52done_testing();