Remove legacy v2 API functional tests
This patch removes the functional tests which against on the legacy V2 API. Partially implements blueprint remove-legacy-v2-api-code Change-Id: Ie7189ddcb2b8bc103104045882055eb6b1fc8290
This commit is contained in:
@@ -47,17 +47,6 @@ class ApiPasteV21Fixture(fixtures.Fixture):
|
||||
group='wsgi')
|
||||
|
||||
|
||||
class ApiPasteLegacyV2Fixture(ApiPasteV21Fixture):
|
||||
|
||||
def _replace_line(self, target_file, line):
|
||||
# NOTE(johnthetubaguy) this is hack so we test the legacy_v2 code
|
||||
# even though its disable by default in api-paste.ini
|
||||
line = line.replace(
|
||||
"/v2: openstack_compute_api_v21_legacy_v2_compatible",
|
||||
"/v2: openstack_compute_api_legacy_v2")
|
||||
target_file.write(line)
|
||||
|
||||
|
||||
class ApiPasteNoProjectId(ApiPasteV21Fixture):
|
||||
|
||||
def _replace_line(self, target_file, line):
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
# Copyright 2011 Justin Santa Barbara
|
||||
# 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.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
# Import extensions to pull in osapi_compute_extension CONF option used below.
|
||||
from nova.tests.functional import api_paste_fixture
|
||||
from nova.tests.functional import integrated_helpers
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ExtensionsTest(integrated_helpers._IntegratedTestBase):
|
||||
api_major_version = 'v2'
|
||||
|
||||
def setUp(self):
|
||||
self.useFixture(api_paste_fixture.ApiPasteLegacyV2Fixture())
|
||||
super(ExtensionsTest, self).setUp()
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ExtensionsTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.tests.unit.api.openstack.compute.legacy_v2.extensions.'
|
||||
'foxinsocks.Foxinsocks')
|
||||
return f
|
||||
|
||||
def test_get_foxnsocks(self):
|
||||
# Simple check that fox-n-socks works.
|
||||
response = self.api.api_request('/foxnsocks')
|
||||
foxnsocks = response.content
|
||||
LOG.debug("foxnsocks: %s" % foxnsocks)
|
||||
self.assertEqual('Try to say this Mr. Knox, sir...', foxnsocks)
|
||||
@@ -24,7 +24,6 @@ from nova.db.sqlalchemy import api as db_api
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
from nova.tests.functional.api import client
|
||||
from nova.tests.functional import api_paste_fixture
|
||||
from nova.tests.unit import fake_network
|
||||
from nova.tests.unit import policy_fixture
|
||||
|
||||
@@ -40,7 +39,7 @@ PROJECT_ID_ALT = "616c6c796f7572626173656172656f73"
|
||||
|
||||
class ServerGroupTestBase(test.TestCase):
|
||||
REQUIRES_LOCKING = True
|
||||
api_major_version = 'v2'
|
||||
api_major_version = 'v2.1'
|
||||
microversion = None
|
||||
_image_ref_parameter = 'imageRef'
|
||||
_flavor_ref_parameter = 'flavorRef'
|
||||
@@ -70,13 +69,8 @@ class ServerGroupTestBase(test.TestCase):
|
||||
|
||||
self.useFixture(policy_fixture.RealPolicyFixture())
|
||||
|
||||
if self.api_major_version == 'v2.1':
|
||||
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
|
||||
api_version='v2.1'))
|
||||
else:
|
||||
self.useFixture(api_paste_fixture.ApiPasteLegacyV2Fixture())
|
||||
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
|
||||
api_version='v2'))
|
||||
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
|
||||
api_version='v2.1'))
|
||||
|
||||
self.api = api_fixture.api
|
||||
self.api.microversion = self.microversion
|
||||
@@ -145,11 +139,10 @@ class ServerGroupTestBase(test.TestCase):
|
||||
return server
|
||||
|
||||
|
||||
class ServerGroupTestV2(ServerGroupTestBase):
|
||||
api_major_version = 'v2'
|
||||
class ServerGroupTestV21(ServerGroupTestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(ServerGroupTestV2, self).setUp()
|
||||
super(ServerGroupTestV21, self).setUp()
|
||||
|
||||
self.start_service('network')
|
||||
self.compute = self.start_service('compute')
|
||||
@@ -472,6 +465,15 @@ class ServerGroupTestV2(ServerGroupTestBase):
|
||||
|
||||
host.start()
|
||||
|
||||
def test_soft_affinity_not_supported(self):
|
||||
ex = self.assertRaises(client.OpenStackApiException,
|
||||
self.api.post_server_groups,
|
||||
{'name': 'fake-name-1',
|
||||
'policies': ['soft-affinity']})
|
||||
self.assertEqual(400, ex.response.status_code)
|
||||
self.assertIn('Invalid input', ex.response.text)
|
||||
self.assertIn('soft-affinity', ex.response.text)
|
||||
|
||||
|
||||
class ServerGroupAffinityConfTest(ServerGroupTestBase):
|
||||
api_major_version = 'v2.1'
|
||||
@@ -557,20 +559,7 @@ class ServerGroupSoftAntiAffinityConfTest(ServerGroupTestBase):
|
||||
self.assertEqual(400, failed_server['fault']['code'])
|
||||
|
||||
|
||||
class ServerGroupTestV21(ServerGroupTestV2):
|
||||
api_major_version = 'v2.1'
|
||||
|
||||
def test_soft_affinity_not_supported(self):
|
||||
ex = self.assertRaises(client.OpenStackApiException,
|
||||
self.api.post_server_groups,
|
||||
{'name': 'fake-name-1',
|
||||
'policies': ['soft-affinity']})
|
||||
self.assertEqual(400, ex.response.status_code)
|
||||
self.assertIn('Invalid input', ex.response.text)
|
||||
self.assertIn('soft-affinity', ex.response.text)
|
||||
|
||||
|
||||
class ServerGroupTestV215(ServerGroupTestV2):
|
||||
class ServerGroupTestV215(ServerGroupTestV21):
|
||||
api_major_version = 'v2.1'
|
||||
microversion = '2.15'
|
||||
|
||||
@@ -825,3 +814,6 @@ class ServerGroupTestV215(ServerGroupTestV2):
|
||||
self._evacuate_with_soft_anti_affinity_policies(
|
||||
self.soft_anti_affinity))
|
||||
self.assertEqual(evacuated_server, other_server)
|
||||
|
||||
def test_soft_affinity_not_supported(self):
|
||||
pass
|
||||
|
||||
@@ -24,7 +24,6 @@ from nova import exception as ex
|
||||
from nova import objects
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
from nova.tests.functional import api_paste_fixture
|
||||
from nova.tests.functional import integrated_helpers as helper
|
||||
from nova.tests.unit import policy_fixture
|
||||
|
||||
@@ -84,11 +83,6 @@ class FlavorManageFullstack(testscenarios.WithScenarios, test.TestCase):
|
||||
# test v2.1 base microversion
|
||||
('v2_1', {
|
||||
'api_major_version': 'v2.1'}),
|
||||
# test v2 with the v2 legacy code
|
||||
('v2legacy', {
|
||||
'api_major_version': 'v2',
|
||||
'_additional_fixtures': [
|
||||
api_paste_fixture.ApiPasteLegacyV2Fixture]})
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user