]> git.proxmox.com Git - pve-manager.git/blame - bin/test/replication_test4.pl
cleanup: add network-hooks directory and move respective files
[pve-manager.git] / bin / 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
11use Data::Dumper;
12
13use Test::MockModule;
14use ReplicationTestEnv;
15
16use PVE::Tools;
17
18$ReplicationTestEnv::mocked_nodename = 'node1';
19
20my $pve_replication_module = Test::MockModule->new('PVE::Replication');
21$pve_replication_module->mock(
22 replicate => sub { die "faked replication error\n"; });
23
24my $testjob = {
25 'type' => 'local',
26 'target' => 'node1',
27 'guest' => 900,
28};
29
30$ReplicationTestEnv::mocked_replication_jobs = {
31 job_900_to_node2 => {
32 'type' => 'local',
33 'target' => 'node2',
34 'guest' => 900,
35 },
36 job_900_to_node1 => {
37 'type' => 'local',
38 'target' => 'node1', # local node, job should be skipped
39 'guest' => 900,
40 },
41};
42
43$ReplicationTestEnv::mocked_vm_configs = {
44 900 => {
45 node => 'node1',
46 snapshots => {},
47 ide0 => 'local-lvm:vm-900-disk-1,size=4G',
48 memory => 512,
49 ide2 => 'none,media=cdrom',
50 },
51};
52
53ReplicationTestEnv::setup();
54
55my $ctime = 1000;
56
57my $status;
58
59ReplicationTestEnv::openlog();
60
61for (my $i = 0; $i < 120; $i++) {
62 ReplicationTestEnv::track_jobs($ctime);
63 $ctime += 60;
64}
65
66ReplicationTestEnv::commit_log();
67
68exit(0);