[pve-devel] [PATCH v3 pve-manager 06/23] replication_test3.pl: regression test for replication to same node

Dietmar Maurer dietmar at proxmox.com
Tue May 30 15:20:03 CEST 2017


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 bin/test/replication_test3.pl | 51 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100755 bin/test/replication_test3.pl

diff --git a/bin/test/replication_test3.pl b/bin/test/replication_test3.pl
new file mode 100755
index 00000000..69d09f07
--- /dev/null
+++ b/bin/test/replication_test3.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+# Note: Try to run replication job to same node (should fail)
+
+use strict;
+use warnings;
+use JSON;
+
+use lib ('.', '../..');
+
+use Data::Dumper;
+
+use Test::MockModule;
+use ReplicationTestEnv;
+
+use Test::More;
+
+$ReplicationTestEnv::mocked_nodename = 'node1';
+
+my $testjob = {
+    'type'  => 'local',
+    'target' => 'node1',
+    'guest' => 900,
+};
+
+$ReplicationTestEnv::mocked_replication_jobs = {
+     job_900_to_node1 => {
+	'type'  => 'local',
+	'target' => 'node1', # local node, job should be skipped
+	'guest' => 900,
+    },
+};
+
+$ReplicationTestEnv::mocked_vm_configs = {
+    900 => {
+	node => 'node1',
+	snapshots => {},
+	ide0 => 'local-lvm:vm-900-disk-1,size=4G',
+	memory => 512,
+	ide2 => 'none,media=cdrom',
+    },
+};
+
+ReplicationTestEnv::setup();
+
+eval { PVE::Replication::run_single_job('job_900_to_node1', 1000); };
+my $err = $@;
+
+is($err, "unable to sync to local node\n", "test error message");
+
+done_testing();
-- 
2.11.0




More information about the pve-devel mailing list