Adds cold migration Mixin

The mixin contains code and tests necessary in order to
test different scenarios / features with cold migration.

The mixins will ensure that the Feature classes they are mixed
into will still behave properly after cold migration.
This commit is contained in:
Claudiu Belu 2017-06-25 12:19:51 -07:00
parent 7f0fa003af
commit 136ef0ac9d
4 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,45 @@
# Copyright 2017 Cloudbase Solutions SRL
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from oswin_tempest_plugin import config
CONF = config.CONF
class _MigrateMixin(object):
"""Cold migration mixin.
This mixin will add a cold migration test. It will perform the
following operations:
* Spawn instance.
* Cold migrate the instance.
* Check the server connectivity.
"""
def _migrate_server(self, server_tuple):
server = server_tuple.server
self.admin_servers_client.migrate_server(server['id'])
self._wait_for_server_status(server, 'VERIFY_RESIZE')
self.servers_client.confirm_resize_server(server['id'])
@testtools.skipUnless(CONF.compute.min_compute_nodes >= 2,
'Expected at least 2 compute nodes.')
def test_migration(self):
server_tuple = self._create_server()
self._migrate_server(server_tuple)
self._check_server_connectivity(server_tuple)

View File

@ -15,11 +15,12 @@
from oswin_tempest_plugin import config
from oswin_tempest_plugin.tests import test_base
from oswin_tempest_plugin.tests._mixins import migrate
CONF = config.CONF
class _BaseDiskTestMixin(object):
class _BaseDiskTestMixin(migrate._MigrateMixin):
"""Image types / formats test suite.
This test suite will spawn instances with a configured image and will

View File

@ -37,7 +37,7 @@ Server_tuple = collections.namedtuple(
class TestBase(tempest.test.BaseTestCase):
"""Base class for tests."""
credentials = ['primary']
credentials = ['primary', 'admin']
# Inheriting TestCases should change this version if needed.
_MIN_HYPERV_VERSION = 6002
@ -70,6 +70,7 @@ class TestBase(tempest.test.BaseTestCase):
cls.os_primary.compute_floating_ips_client)
cls.keypairs_client = cls.os_primary.keypairs_client
cls.servers_client = cls.os_primary.servers_client
cls.admin_servers_client = cls.os_admin.servers_client
# Neutron network client
cls.security_groups_client = (