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