]> git.proxmox.com Git - pve-manager.git/blame - test/replication_test4.pl
ui: vm wizard: reword label for extra drive for virtio-drivers
[pve-manager.git] / test / replication_test4.pl
CommitLineData
6e572d46
DM
1#!/usr/bin/perl
2
3# Note: Test replication job failure
4
5use strict;
6use warnings;
7use JSON;
8
9use lib ('.', '../..');
10
6e572d46
DM
11use Test::MockModule;
12use ReplicationTestEnv;
13
14use PVE::Tools;
15
16$ReplicationTestEnv::mocked_nodename = 'node1';
17
18my $pve_replication_module = Test::MockModule->new('PVE::Replication');
19$pve_replication_module->mock(
20 replicate => sub { die "faked replication error\n"; });
21
22my $testjob = {
23 'type' => 'local',
24 'target' => 'node1',
25 'guest' => 900,
26};
27
28$ReplicationTestEnv::mocked_replication_jobs = {
29 job_900_to_node2 => {
30 'type' => 'local',
31 'target' => 'node2',
32 'guest' => 900,
33 },
34 job_900_to_node1 => {
35 'type' => 'local',
36 'target' => 'node1', # local node, job should be skipped
37 'guest' => 900,
38 },
39};
40
41$ReplicationTestEnv::mocked_vm_configs = {
42 900 => {
43 node => 'node1',
44 snapshots => {},
45 ide0 => 'local-lvm:vm-900-disk-1,size=4G',
46 memory => 512,
47 ide2 => 'none,media=cdrom',
48 },
49};
50
51ReplicationTestEnv::setup();
52
53my $ctime = 1000;
54
55my $status;
56
57ReplicationTestEnv::openlog();
58
59for (my $i = 0; $i < 120; $i++) {
60 ReplicationTestEnv::track_jobs($ctime);
61 $ctime += 60;
62}
63
64ReplicationTestEnv::commit_log();
65
66exit(0);