Add configuration for compute unified limits feature

This adds a config option to indicate the presence of the unified
limits feature in the compute service and skips tests that depend
on the feature being present or absent.

Related to blueprint unified-limits-nova

Change-Id: I9508b41f1a0a208dbce090a4143cb87b858fc5f2
This commit is contained in:
melanie witt 2021-05-06 22:41:30 +00:00
parent d771c95ee8
commit 74fa505748
3 changed files with 26 additions and 0 deletions

View File

@ -14,14 +14,17 @@
# under the License.
from oslo_log import log as logging
import testtools
from testtools import matchers
from tempest.api.compute import base
from tempest.common import identity
from tempest.common import tempest_fixtures as fixtures
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
CONF = config.CONF
LOG = logging.getLogger(__name__)
@ -110,6 +113,8 @@ class QuotasAdminTestJSON(QuotasAdminTestBase):
self.assertIn(quota, quota_set.keys())
@decorators.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_update_all_quota_resources_for_tenant(self):
"""Test admin can update all the compute quota limits for a project"""
default_quota_set = self.adm_client.show_default_quota_set(
@ -141,11 +146,15 @@ class QuotasAdminTestJSON(QuotasAdminTestBase):
# TODO(afazekas): merge these test cases
@decorators.idempotent_id('ce9e0815-8091-4abd-8345-7fe5b85faa1d')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_get_updated_quotas(self):
"""Test that GET shows the updated quota set of project"""
self._get_updated_quotas()
@decorators.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_delete_quota(self):
"""Test admin can delete the compute quota set for a project"""
project_name = data_utils.rand_name('ram_quota_project')
@ -178,6 +187,8 @@ class QuotasAdminTestV236(QuotasAdminTestBase):
min_microversion = '2.36'
@decorators.idempotent_id('4268b5c9-92e5-4adc-acf1-3a2798f3d803')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_get_updated_quotas(self):
"""Test compute quotas API with microversion greater than 2.35
@ -197,6 +208,8 @@ class QuotasAdminTestV257(QuotasAdminTestBase):
min_microversion = '2.57'
@decorators.idempotent_id('e641e6c6-e86c-41a4-9e5c-9493c0ae47ad')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_get_updated_quotas(self):
"""Test compute quotas API with microversion greater than 2.56
@ -228,6 +241,8 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest):
# tests that get run all by themselves at the end under a
# 'danger' flag.
@decorators.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_update_default_quotas(self):
"""Test updating default compute quota class set"""
# get the current 'default' quota class values

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from tempest.api.compute import base
from tempest.common import utils
from tempest import config
@ -68,6 +70,8 @@ class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase):
# It can be moved into the setUpClass as well.
@decorators.attr(type=['negative'])
@decorators.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_create_server_when_cpu_quota_is_full(self):
"""Disallow server creation when tenant's vcpu quota is full"""
self._update_quota('cores', 0)
@ -76,6 +80,8 @@ class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_create_server_when_memory_quota_is_full(self):
"""Disallow server creation when tenant's memory quota is full"""
self._update_quota('ram', 0)
@ -84,6 +90,8 @@ class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161')
@testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
'Legacy quota update not available with unified limits')
def test_create_server_when_instances_quota_is_full(self):
"""Once instances quota limit is reached, disallow server creation"""
self._update_quota('instances', 0)

View File

@ -650,6 +650,9 @@ ComputeFeaturesGroup = [
default=True,
help='Does the test environment support attaching devices '
'using an IDE bus to the instance?'),
cfg.BoolOpt('unified_limits',
default=False,
help='Does the test environment support unified limits?'),
]