Merge migrate server tests between v2 and v2.1
Currently v2 and v2.1 have separate functional tests and their corresponding sample files. As v2 and v2.1 are supposed to be identical, there is overhead to maintain two set of functional tests and sample files. We can have one set of tests which can run for both v2 and v2.1. This commit merges servers actions migrate, live migrate server functional tests. In V2.1 os-access-ip is separate plugin where in v2 it was mixed in server plugin itself. So os-access-ip extension is enabled to run merged functional tests for both v2 and v2.1. Change-Id: Ie02bb74b9e9a33d18f984f9821171d91972c4f20
This commit is contained in:
parent
e8707aa3b5
commit
c1517c3a92
@ -1,7 +0,0 @@
|
||||
{
|
||||
"os-migrateLive": {
|
||||
"host": "0443e9a1254044d8b99f35eace132080",
|
||||
"block_migration": false,
|
||||
"disk_over_commit": false
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"migrate": null
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"os-migrateLive": {
|
||||
"host": "%(hostname)s",
|
||||
"block_migration": false,
|
||||
"disk_over_commit": false
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"migrate": null
|
||||
}
|
@ -37,7 +37,6 @@ from nova.cells import utils as cells_utils
|
||||
from nova.cloudpipe import pipelib
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import cells_api as cells_api
|
||||
from nova.conductor import manager as conductor_manager
|
||||
from nova.console import manager as console_manager # noqa - only for cfg
|
||||
from nova import db
|
||||
from nova.network import api as network_api
|
||||
@ -812,13 +811,6 @@ class AdminActionsSamplesJsonTest(ServersSampleBase):
|
||||
super(AdminActionsSamplesJsonTest, self).setUp()
|
||||
self.uuid = self._post_server()
|
||||
|
||||
@mock.patch('nova.conductor.manager.ComputeTaskManager._cold_migrate')
|
||||
def test_post_migrate(self, mock_cold_migrate):
|
||||
# Get api samples to migrate server request.
|
||||
response = self._do_post('servers/%s/action' % self.uuid,
|
||||
'admin-actions-migrate', {})
|
||||
self.assertEqual(response.status_code, 202)
|
||||
|
||||
def test_post_reset_network(self):
|
||||
# Get api samples to reset server network request.
|
||||
response = self._do_post('servers/%s/action' % self.uuid,
|
||||
@ -831,36 +823,6 @@ class AdminActionsSamplesJsonTest(ServersSampleBase):
|
||||
'admin-actions-inject-network-info', {})
|
||||
self.assertEqual(response.status_code, 202)
|
||||
|
||||
def test_post_live_migrate_server(self):
|
||||
# Get api samples to server live migrate request.
|
||||
def fake_live_migrate(_self, context, instance, scheduler_hint,
|
||||
block_migration, disk_over_commit):
|
||||
self.assertEqual(self.uuid, instance["uuid"])
|
||||
host = scheduler_hint["host"]
|
||||
self.assertEqual(self.compute.host, host)
|
||||
|
||||
self.stubs.Set(conductor_manager.ComputeTaskManager,
|
||||
'_live_migrate',
|
||||
fake_live_migrate)
|
||||
|
||||
def fake_get_compute(context, host):
|
||||
service = dict(host=host,
|
||||
binary='nova-compute',
|
||||
topic='compute',
|
||||
report_count=1,
|
||||
updated_at='foo',
|
||||
hypervisor_type='bar',
|
||||
hypervisor_version=
|
||||
utils.convert_version_to_int('1.0'),
|
||||
disabled=False)
|
||||
return {'compute_node': [service]}
|
||||
self.stubs.Set(db, "service_get_by_compute_host", fake_get_compute)
|
||||
|
||||
response = self._do_post('servers/%s/action' % self.uuid,
|
||||
'admin-actions-live-migrate',
|
||||
{'hostname': self.compute.host})
|
||||
self.assertEqual(response.status_code, 202)
|
||||
|
||||
def test_post_reset_state(self):
|
||||
# get api samples to server reset state request.
|
||||
response = self._do_post('servers/%s/action' % self.uuid,
|
||||
|
@ -14,16 +14,31 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
from nova.conductor import manager as conductor_manager
|
||||
from nova import db
|
||||
from nova.tests.functional.v3 import test_servers
|
||||
from nova import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('osapi_compute_extension',
|
||||
'nova.api.openstack.compute.extensions')
|
||||
|
||||
|
||||
class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-migrate-server"
|
||||
ctype = 'json'
|
||||
extra_extensions_to_load = ["os-access-ips"]
|
||||
_api_version = 'v2'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(MigrateServerSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.'
|
||||
'Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for MigrateServer api samples extension
|
||||
|
Loading…
x
Reference in New Issue
Block a user