Merge "Add configuration for compute unified limits feature"

This commit is contained in:
Zuul 2022-03-04 12:30:56 +00:00 committed by Gerrit Code Review
commit 721504b102
3 changed files with 26 additions and 0 deletions

View File

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

View File

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

View File

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