]> git.proxmox.com Git - pve-manager.git/blob - bin/test/replication_test1.pl
0dfcf05adf1eebba37320eb0026d091adfdf5f4d
[pve-manager.git] / bin / test / replication_test1.pl
1 #!/usr/bin/perl
2
3 # Note: Test if mockup from ReplicationTestEnv works
4
5 use strict;
6 use warnings;
7 use JSON;
8
9 use lib ('.', '../..');
10
11 use Data::Dumper;
12
13 use ReplicationTestEnv;
14 use Test::More tests => 3;
15
16 $ReplicationTestEnv::mocked_nodename = 'node1';
17
18 my $testjob = {
19 'type' => 'local',
20 'target' => 'node1',
21 'guest' => 900,
22 };
23
24 $ReplicationTestEnv::mocked_replication_jobs = {
25 job_900_to_node1 => $testjob,
26 };
27
28 $ReplicationTestEnv::mocked_vm_configs = {
29 900 => {
30 node => 'node1',
31 snapshots => {},
32 ide0 => 'local-lvm:vm-900-disk-1,size=4G',
33 memory => 512,
34 ide2 => 'none,media=cdrom',
35 },
36 };
37
38 ReplicationTestEnv::setup();
39
40 ok(PVE::INotify::nodename() eq 'node1');
41
42 my $list = PVE::Cluster::get_vmlist();
43 is_deeply($list, { ids => {900 => { node => 'node1', type => 'qemu', version => 1}}});
44 my $cfg = PVE::ReplicationConfig->new();
45 is_deeply($cfg, { ids => { job_900_to_node1 => $testjob }});
46
47 exit(0);