Merge "Remove quota whitebox tests"
This commit is contained in:
@@ -50,70 +50,6 @@ class ServersWhiteboxTest(manager.ComputeWhiteboxTest):
|
||||
except exceptions.NotFound:
|
||||
continue
|
||||
|
||||
def test_create_server_vcpu_quota_full(self):
|
||||
# Disallow server creation when tenant's vcpu quota is full
|
||||
quotas = self.meta.tables['quotas']
|
||||
stmt = (quotas.select().
|
||||
where(quotas.c.project_id == self.tenant_id).
|
||||
where(quotas.c.resource == 'cores'))
|
||||
result = self.connection.execute(stmt).first()
|
||||
|
||||
# Set vcpu quota for tenant if not already set
|
||||
if not result:
|
||||
cores_hard_limit = 2
|
||||
stmt = quotas.insert().values(deleted=0,
|
||||
project_id=self.tenant_id,
|
||||
resource='cores',
|
||||
hard_limit=cores_hard_limit)
|
||||
|
||||
self.connection.execute(stmt, autocommit=True)
|
||||
else:
|
||||
cores_hard_limit = result.hard_limit
|
||||
|
||||
# Create servers assuming 1 VCPU per instance i.e flavor_id=1
|
||||
try:
|
||||
for count in range(cores_hard_limit + 1):
|
||||
self.create_server()
|
||||
except exceptions.OverLimit:
|
||||
pass
|
||||
else:
|
||||
self.fail("Could create servers over the VCPU quota limit")
|
||||
finally:
|
||||
stmt = quotas.delete()
|
||||
self.connection.execute(stmt, autocommit=True)
|
||||
|
||||
def test_create_server_memory_quota_full(self):
|
||||
# Disallow server creation when tenant's memory quota is full
|
||||
quotas = self.meta.tables['quotas']
|
||||
stmt = (quotas.select().
|
||||
where(quotas.c.project_id == self.tenant_id).
|
||||
where(quotas.c.resource == 'ram'))
|
||||
result = self.connection.execute(stmt).first()
|
||||
|
||||
# Set memory quota for tenant if not already set
|
||||
if not result:
|
||||
ram_hard_limit = 1024
|
||||
stmt = quotas.insert().values(deleted=0,
|
||||
project_id=self.tenant_id,
|
||||
resource='ram',
|
||||
hard_limit=ram_hard_limit)
|
||||
|
||||
self.connection.execute(stmt, autocommit=True)
|
||||
else:
|
||||
ram_hard_limit = result.hard_limit
|
||||
|
||||
try:
|
||||
# Set a hard range of 3 servers for reaching the RAM quota
|
||||
for count in range(3):
|
||||
self.create_server()
|
||||
except exceptions.OverLimit:
|
||||
pass
|
||||
else:
|
||||
self.fail("Could create servers over the RAM quota limit")
|
||||
finally:
|
||||
stmt = quotas.delete()
|
||||
self.connection.execute(stmt, autocommit=True)
|
||||
|
||||
def update_state(self, server_id, vm_state, task_state, deleted=0):
|
||||
"""Update states of an instance in database for validation."""
|
||||
if not task_state:
|
||||
|
||||
Reference in New Issue
Block a user