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>
This commit is contained in:
parent
d7c9a83344
commit
63adf16d4f
|
@ -34,6 +34,16 @@ class Migration(Test):
|
||||||
self.assertEqual(dst_vm.command('query-status')['status'], 'running')
|
self.assertEqual(dst_vm.command('query-status')['status'], 'running')
|
||||||
self.assertEqual(src_vm.command('query-status')['status'],'postmigrate')
|
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):
|
def _get_free_port(self):
|
||||||
port = network.find_free_port()
|
port = network.find_free_port()
|
||||||
if port is None:
|
if port is None:
|
||||||
|
@ -42,10 +52,5 @@ class Migration(Test):
|
||||||
|
|
||||||
|
|
||||||
def test_migration_with_tcp_localhost(self):
|
def test_migration_with_tcp_localhost(self):
|
||||||
source_vm = self.get_vm()
|
|
||||||
dest_uri = 'tcp:localhost:%u' % self._get_free_port()
|
dest_uri = 'tcp:localhost:%u' % self._get_free_port()
|
||||||
dest_vm = self.get_vm('-incoming', dest_uri)
|
self.do_migrate(dest_uri)
|
||||||
dest_vm.launch()
|
|
||||||
source_vm.launch()
|
|
||||||
source_vm.qmp('migrate', uri=dest_uri)
|
|
||||||
self.assert_migration(source_vm, dest_vm)
|
|
||||||
|
|
Loading…
Reference in a new issue