Merge "Remove compute api_extensions config option"

This commit is contained in:
Zuul 2022-05-06 14:45:37 +00:00 committed by Gerrit Code Review
commit a06eb65363
15 changed files with 12 additions and 162 deletions

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Remove deprecated config option ``api_extensions`` from
``compute_feature_enabled`` groups.

View File

@ -16,7 +16,6 @@
import uuid
from tempest.api.compute import base
from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@ -25,13 +24,6 @@ from tempest.lib import exceptions as lib_exc
class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
"""Tests Flavors API Create and Delete that require admin privileges"""
@classmethod
def skip_checks(cls):
super(FlavorsAdminTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "OS-FLV-EXT-DATA extension not enabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
super(FlavorsAdminTestJSON, cls).resource_setup()

View File

@ -14,7 +14,6 @@
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.lib import decorators
@ -24,13 +23,6 @@ class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest):
Add and remove Flavor Access require admin privileges.
"""
@classmethod
def skip_checks(cls):
super(FlavorsAccessTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "OS-FLV-EXT-DATA extension not enabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
super(FlavorsAccessTestJSON, cls).resource_setup()

View File

@ -14,7 +14,6 @@
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@ -27,13 +26,6 @@ class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest):
credentials = ['primary', 'admin', 'alt']
@classmethod
def skip_checks(cls):
super(FlavorsAccessNegativeTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "OS-FLV-EXT-DATA extension not enabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
super(FlavorsAccessNegativeTestJSON, cls).resource_setup()

View File

@ -14,7 +14,6 @@
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -26,13 +25,6 @@ class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
GET Flavor Extra specs can be performed even by without admin privileges.
"""
@classmethod
def skip_checks(cls):
super(FlavorsExtraSpecsTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "OS-FLV-EXT-DATA extension not enabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
super(FlavorsExtraSpecsTestJSON, cls).resource_setup()

View File

@ -15,7 +15,6 @@
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@ -27,13 +26,6 @@ class FlavorsExtraSpecsNegativeTestJSON(base.BaseV2ComputeAdminTest):
SET, UNSET, UPDATE Flavor Extra specs require admin privileges.
"""
@classmethod
def skip_checks(cls):
super(FlavorsExtraSpecsNegativeTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "OS-FLV-EXT-DATA extension not enabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
super(FlavorsExtraSpecsNegativeTestJSON, cls).resource_setup()

View File

@ -17,7 +17,6 @@ import testtools
from tempest.api.compute import base
from tempest.common import compute
from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -31,13 +30,6 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
"""
create_default_network = True
@classmethod
def skip_checks(cls):
super(ServerGroupTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('os-server-groups', 'compute'):
msg = "os-server-groups extension is not enabled."
raise cls.skipException(msg)
@classmethod
def setup_clients(cls):
super(ServerGroupTestJSON, cls).setup_clients()

View File

@ -14,7 +14,6 @@
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -27,13 +26,6 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
create_default_network = True
@classmethod
def skip_checks(cls):
super(ServerTagsTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('os-server-tags', 'compute'):
msg = "os-server-tags extension is not enabled."
raise cls.skipException(msg)
@classmethod
def setup_clients(cls):
super(ServerTagsTestJSON, cls).setup_clients()

View File

@ -16,7 +16,6 @@
from oslo_log import log as logging
from tempest.api.compute import base
from tempest.common import utils
from tempest import config
from tempest.lib import decorators
@ -32,24 +31,14 @@ class ExtensionsTest(base.BaseV2ComputeTest):
@decorators.idempotent_id('3bb27738-b759-4e0d-a5fa-37d7a6df07d1')
def test_list_extensions(self):
"""Test listing compute extensions"""
if not CONF.compute_feature_enabled.api_extensions:
raise self.skipException('There are not any extensions configured')
extensions = self.extensions_client.list_extensions()['extensions']
ext = CONF.compute_feature_enabled.api_extensions[0]
# Log extensions list
extension_list = [x['alias'] for x in extensions]
LOG.debug("Nova extensions: %s", ','.join(extension_list))
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext:
self.assertIn(ext, extension_list)
else:
raise self.skipException('There are not any extensions configured')
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
@decorators.idempotent_id('05762f39-bdfa-4cdb-9b46-b78f8e78e2fd')
@utils.requires_ext(extension='os-consoles', service='compute')
def test_get_extension(self):
"""Test getting specified compute extension details"""
extension = self.extensions_client.show_extension('os-consoles')

View File

@ -15,20 +15,12 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common import utils
from tempest.lib import decorators
class QuotasTestJSON(base.BaseV2ComputeTest):
"""Test compute quotas"""
@classmethod
def skip_checks(cls):
super(QuotasTestJSON, cls).skip_checks()
if not utils.is_extension_enabled('os-quota-sets', 'compute'):
msg = "quotas extension not enabled."
raise cls.skipException(msg)
def setUp(self):
# NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
self.useFixture(fixtures.LockFixture('compute_quotas'))

View File

@ -214,7 +214,6 @@ def verify_api_versions(os, service, update):
def get_extension_client(os, service):
extensions_client = {
'nova': os.compute.ExtensionsClient(),
'neutron': os.network.ExtensionsClient(),
'swift': os.object_storage.CapabilitiesClient(),
# NOTE: Cinder v3 API is current and v2 and v1 are deprecated.
@ -231,7 +230,6 @@ def get_extension_client(os, service):
def get_enabled_extensions(service):
extensions_options = {
'nova': CONF.compute_feature_enabled.api_extensions,
'cinder': CONF.volume_feature_enabled.api_extensions,
'neutron': CONF.network_feature_enabled.api_extensions,
'swift': CONF.object_storage_feature_enabled.discoverable_apis,
@ -442,7 +440,7 @@ def main(opts=None):
os = clients.Manager(icreds.get_primary_creds().credentials)
services = check_service_availability(os, update)
results = {}
for service in ['nova', 'cinder', 'neutron', 'swift']:
for service in ['cinder', 'neutron', 'swift']:
if service not in services:
continue
results = verify_extensions(os, service, results)

View File

@ -96,7 +96,6 @@ def is_extension_enabled(extension_name, service):
"""
config_dict = {
'compute': CONF.compute_feature_enabled.api_extensions,
'volume': CONF.volume_feature_enabled.api_extensions,
'network': CONF.network_feature_enabled.api_extensions,
'object': CONF.object_storage_feature_enabled.discoverable_apis,

View File

@ -450,18 +450,6 @@ ComputeFeaturesGroup = [
"the '.' with '-' to comply with fqdn hostname. Nova "
"changed that in Wallaby cycle, if your cloud is older "
"than wallaby then you can keep/make it False."),
cfg.ListOpt('api_extensions',
default=['all'],
help='A list of enabled compute extensions with a special '
'entry all which indicates every extension is enabled. '
'Each extension should be specified with alias name. '
'Empty list indicates all extensions are disabled',
deprecated_for_removal=True,
deprecated_reason='The Nova extensions API and mechanism '
'is deprecated. This option will be '
'removed when all releases supported '
'by tempest no longer contain the Nova '
'extensions API and mechanism.'),
cfg.BoolOpt('change_password',
default=False,
help="Does the test environment support changing the admin "

View File

@ -380,70 +380,6 @@ class TestDiscovery(base.TestCase):
self.assertIn('extensions', results['cinder'])
self.assertEqual([], results['cinder']['extensions'])
def test_verify_extensions_nova(self):
def fake_list_extensions():
return ([{'alias': 'fake1'}, {'alias': 'fake2'},
{'alias': 'not_fake'}])
fake_os = mock.MagicMock()
fake_client = mock.MagicMock()
fake_client.list_extensions = fake_list_extensions
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, 'get_extension_client',
return_value=fake_client))
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, 'get_enabled_extensions',
return_value=(['fake1', 'fake2', 'fake3'])))
results = verify_tempest_config.verify_extensions(fake_os,
'nova', {})
self.assertIn('nova', results)
self.assertIn('fake1', results['nova'])
self.assertTrue(results['nova']['fake1'])
self.assertIn('fake2', results['nova'])
self.assertTrue(results['nova']['fake2'])
self.assertIn('fake3', results['nova'])
self.assertFalse(results['nova']['fake3'])
self.assertIn('not_fake', results['nova'])
self.assertFalse(results['nova']['not_fake'])
def test_verify_extensions_nova_all(self):
def fake_list_extensions():
return ({'extensions': [{'alias': 'fake1'},
{'alias': 'fake2'},
{'alias': 'not_fake'}]})
fake_os = mock.MagicMock()
fake_client = mock.MagicMock()
fake_client.list_extensions = fake_list_extensions
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, 'get_extension_client',
return_value=fake_client))
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, 'get_enabled_extensions',
return_value=(['all'])))
results = verify_tempest_config.verify_extensions(fake_os,
'nova', {})
self.assertIn('nova', results)
self.assertIn('extensions', results['nova'])
self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
sorted(results['nova']['extensions']))
def test_verify_extensions_nova_none(self):
def fake_list_extensions():
return ({'extensions': []})
fake_os = mock.MagicMock()
fake_client = mock.MagicMock()
fake_client.list_extensions = fake_list_extensions
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, 'get_extension_client',
return_value=fake_client))
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, 'get_enabled_extensions',
return_value=(['all'])))
results = verify_tempest_config.verify_extensions(fake_os,
'nova', {})
self.assertIn('nova', results)
self.assertIn('extensions', results['nova'])
self.assertEqual([], results['nova']['extensions'])
def test_verify_extensions_swift(self):
def fake_list_extensions():
return {'fake1': 'metadata',
@ -513,7 +449,6 @@ class TestDiscovery(base.TestCase):
def test_get_extension_client(self):
fake_os = mock.MagicMock()
services = {
'nova': fake_os.compute.ExtensionsClient(),
'neutron': fake_os.network.ExtensionsClient(),
'swift': fake_os.object_storage.CapabilitiesClient(),
'cinder': fake_os.volume_v2.ExtensionsClient(),

View File

@ -92,7 +92,7 @@ class TestRequiresExtDecorator(BaseDecoratorsTest):
def setUp(self):
super(TestRequiresExtDecorator, self).setUp()
cfg.CONF.set_default('api_extensions', ['enabled_ext', 'another_ext'],
'compute-feature-enabled')
'network-feature-enabled')
def _test_requires_ext_helper(self, expected_to_skip=True,
**decorator_args):
@ -116,18 +116,18 @@ class TestRequiresExtDecorator(BaseDecoratorsTest):
def test_requires_ext_decorator(self):
self._test_requires_ext_helper(expected_to_skip=False,
extension='enabled_ext',
service='compute')
service='network')
def test_requires_ext_decorator_disabled_ext(self):
self._test_requires_ext_helper(extension='disabled_ext',
service='compute')
service='network')
def test_requires_ext_decorator_with_all_ext_enabled(self):
cfg.CONF.set_default('api_extensions', ['all'],
group='compute-feature-enabled')
group='network-feature-enabled')
self._test_requires_ext_helper(expected_to_skip=False,
extension='random_ext',
service='compute')
service='network')
def test_requires_ext_decorator_bad_service(self):
self.assertRaises(KeyError,