From 63adf16d4fc422405dd116829368c2480cbc67b5 Mon Sep 17 00:00:00 2001 From: Oksana Vohchana Date: Mon, 3 Feb 2020 13:16:30 +0200 Subject: tests/acceptance/migration: Factor out do_migrate() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are going to reuse this code when testing different transport methods, so factor it out first. Signed-off-by: Oksana Vohchana Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200203111631.18796-2-ovoshcha@redhat.com> [PMD: Split patch in 2, reworded subject and description] Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/migration.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'tests/acceptance') 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) -- cgit v1.2.3