Merge suspend-server functional tests of 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 suspend-server functional tests.

Change-Id: I3074d2544acecabca57b199357ccdce0dcde6a04
This commit is contained in:
parklong 2015-04-16 15:31:22 +08:00
parent f713c7c7b5
commit a3050ec751
6 changed files with 18 additions and 25 deletions

View File

@ -1,3 +0,0 @@
{
"resume": null
}

View File

@ -1,3 +0,0 @@
{
"suspend": null
}

View File

@ -1259,19 +1259,6 @@ class AdminActionsSamplesJsonTest(ServersSampleBase):
'admin-actions-unpause', {})
self.assertEqual(response.status_code, 202)
def test_post_suspend(self):
# Get api samples to suspend server request.
response = self._do_post('servers/%s/action' % self.uuid,
'admin-actions-suspend', {})
self.assertEqual(response.status_code, 202)
def test_post_resume(self):
# Get api samples to server resume request.
self.test_post_suspend()
response = self._do_post('servers/%s/action' % self.uuid,
'admin-actions-resume', {})
self.assertEqual(response.status_code, 202)
@mock.patch('nova.conductor.manager.ComputeTaskManager._cold_migrate')
def test_post_migrate(self, mock_cold_migrate):
# Get api samples to migrate server request.

View File

@ -12,12 +12,30 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-suspend-server"
ctype = 'json'
extra_extensions_to_load = ["os-access-ips"]
# TODO(park): Overriding '_api_version' till all functional tests
# are merged between v2 and v2.1. After that base class variable
# itself can be changed to 'v2'
_api_version = 'v2'
def _get_flags(self):
f = super(SuspendServerSamplesJsonTest, 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 SuspendServer api samples extension