summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorOksana Vohchana <ovoshcha@redhat.com>2020-02-03 13:16:30 +0200
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-07 15:12:48 +0100
commit63adf16d4fc422405dd116829368c2480cbc67b5 (patch)
tree4513900ca48d1619d150271af1fba304bc0b32fc
parentd7c9a83344d955300262bba3d7c455a8cfd6f6e0 (diff)
downloadfocaccia-qemu-63adf16d4fc422405dd116829368c2480cbc67b5.tar.gz
focaccia-qemu-63adf16d4fc422405dd116829368c2480cbc67b5.zip
tests/acceptance/migration: Factor out do_migrate()
We are going to reuse this code when testing different transport
methods, so factor it out first.

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200203111631.18796-2-ovoshcha@redhat.com>
[PMD: Split patch in 2, reworded subject and description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to '')
-rw-r--r--tests/acceptance/migration.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index 3db733b1ce..03686d7de3 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -34,6 +34,16 @@ class Migration(Test):
         self.assertEqual(dst_vm.command('query-status')['status'], 'running')
         self.assertEqual(src_vm.command('query-status')['status'],'postmigrate')
 
+    def do_migrate(self, dest_uri, src_uri=None):
+        source_vm = self.get_vm()
+        dest_vm = self.get_vm('-incoming', dest_uri)
+        dest_vm.launch()
+        if src_uri is None:
+            src_uri = dest_uri
+        source_vm.launch()
+        source_vm.qmp('migrate', uri=src_uri)
+        self.assert_migration(source_vm, dest_vm)
+
     def _get_free_port(self):
         port = network.find_free_port()
         if port is None:
@@ -42,10 +52,5 @@ class Migration(Test):
 
 
     def test_migration_with_tcp_localhost(self):
-        source_vm = self.get_vm()
         dest_uri = 'tcp:localhost:%u' % self._get_free_port()
-        dest_vm = self.get_vm('-incoming', dest_uri)
-        dest_vm.launch()
-        source_vm.launch()
-        source_vm.qmp('migrate', uri=dest_uri)
-        self.assert_migration(source_vm, dest_vm)
+        self.do_migrate(dest_uri)