Forbid availability_zone None in aggregate Nova API
In aggregate API, argument "availability_zone" became optional in the request. Fixed tempest code same as nova. Change-Id: I73f42c6c069a9bc6318ac3bac5ec94b61c65ecaf Related-bug: #1252177
This commit is contained in:
parent
bbe9d9bc0b
commit
f93d2487b0
@ -44,7 +44,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_create_delete(self):
|
||||
# Create and delete an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertEqual(aggregate_name, aggregate['name'])
|
||||
self.assertEqual(None, aggregate['availability_zone'])
|
||||
@ -58,7 +58,8 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# Create and delete an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
az_name = data_utils.rand_name(self.az_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
|
||||
resp, aggregate = self.client.create_aggregate(
|
||||
name=aggregate_name, availability_zone=az_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertEqual(aggregate_name, aggregate['name'])
|
||||
self.assertEqual(az_name, aggregate['availability_zone'])
|
||||
@ -71,7 +72,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_create_verify_entry_in_list(self):
|
||||
# Create an aggregate and ensure it is listed.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
resp, aggregates = self.client.list_aggregates()
|
||||
@ -84,7 +85,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_create_update_metadata_get_details(self):
|
||||
# Create an aggregate and ensure its details are returned.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
resp, body = self.client.get_aggregate(aggregate['id'])
|
||||
@ -111,7 +112,8 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
az_name = data_utils.rand_name(self.az_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
|
||||
resp, aggregate = self.client.create_aggregate(
|
||||
name=aggregate_name, availability_zone=az_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
@ -142,7 +144,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# Add an host to the given aggregate and remove.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
resp, body = self.client.add_host(aggregate['id'], self.host)
|
||||
@ -164,7 +166,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# Add an host to the given aggregate and list.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
self.client.add_host(aggregate['id'], self.host)
|
||||
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
|
||||
@ -182,7 +184,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# Add an host to the given aggregate and get details.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
self.client.add_host(aggregate['id'], self.host)
|
||||
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
|
||||
@ -198,7 +200,8 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
az_name = data_utils.rand_name(self.az_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
|
||||
resp, aggregate = self.client.create_aggregate(
|
||||
name=aggregate_name, availability_zone=az_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
self.client.add_host(aggregate['id'], self.host)
|
||||
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
|
||||
|
@ -47,14 +47,14 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
self.assertRaises(exceptions.Unauthorized,
|
||||
self.user_client.create_aggregate,
|
||||
aggregate_name)
|
||||
name=aggregate_name)
|
||||
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_aggregate_create_aggregate_name_length_less_than_1(self):
|
||||
# the length of aggregate name should >= 1 and <=255
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.client.create_aggregate,
|
||||
'')
|
||||
name='')
|
||||
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_aggregate_create_aggregate_name_length_exceeds_255(self):
|
||||
@ -62,25 +62,25 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
aggregate_name = 'a' * 256
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.client.create_aggregate,
|
||||
aggregate_name)
|
||||
name=aggregate_name)
|
||||
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_aggregate_create_with_existent_aggregate_name(self):
|
||||
# creating an aggregate with existent aggregate name is forbidden
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self.client.create_aggregate,
|
||||
aggregate_name)
|
||||
name=aggregate_name)
|
||||
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_aggregate_delete_as_user(self):
|
||||
# Regular user is not allowed to delete an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -98,7 +98,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_get_details_as_user(self):
|
||||
# Regular user is not allowed to get aggregate details.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -129,7 +129,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
break
|
||||
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
self.assertRaises(exceptions.NotFound, self.client.add_host,
|
||||
@ -139,7 +139,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_add_host_as_user(self):
|
||||
# Regular user is not allowed to add a host to an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -151,7 +151,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_add_existent_host(self):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -167,7 +167,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# Regular user is not allowed to remove a host from an aggregate.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
resp, body = self.client.add_host(aggregate['id'], self.host)
|
||||
@ -182,7 +182,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def test_aggregate_remove_nonexistent_host(self):
|
||||
non_exist_host = data_utils.rand_name('nonexist_host_')
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(200, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
|
@ -45,7 +45,7 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_create_delete(self):
|
||||
# Create and delete an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.assertEqual(aggregate_name, aggregate['name'])
|
||||
self.assertEqual(None, aggregate['availability_zone'])
|
||||
@ -59,7 +59,8 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
# Create and delete an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
az_name = data_utils.rand_name(self.az_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
|
||||
resp, aggregate = self.client.create_aggregate(
|
||||
name=aggregate_name, availability_zone=az_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.assertEqual(aggregate_name, aggregate['name'])
|
||||
self.assertEqual(az_name, aggregate['availability_zone'])
|
||||
@ -72,7 +73,7 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_create_verify_entry_in_list(self):
|
||||
# Create an aggregate and ensure it is listed.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
resp, aggregates = self.client.list_aggregates()
|
||||
@ -85,7 +86,7 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_create_update_metadata_get_details(self):
|
||||
# Create an aggregate and ensure its details are returned.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
resp, body = self.client.get_aggregate(aggregate['id'])
|
||||
@ -112,7 +113,8 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
az_name = data_utils.rand_name(self.az_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
|
||||
resp, aggregate = self.client.create_aggregate(
|
||||
name=aggregate_name, availability_zone=az_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
self.assertEqual(201, resp.status)
|
||||
@ -143,7 +145,7 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
# Add an host to the given aggregate and remove.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
resp, body = self.client.add_host(aggregate['id'], self.host)
|
||||
@ -165,7 +167,7 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
# Add an host to the given aggregate and list.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
self.client.add_host(aggregate['id'], self.host)
|
||||
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
|
||||
@ -183,7 +185,7 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
# Add an host to the given aggregate and get details.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
self.client.add_host(aggregate['id'], self.host)
|
||||
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
|
||||
@ -199,7 +201,8 @@ class AggregatesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
az_name = data_utils.rand_name(self.az_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
|
||||
resp, aggregate = self.client.create_aggregate(
|
||||
name=aggregate_name, availability_zone=az_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
self.client.add_host(aggregate['id'], self.host)
|
||||
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
|
||||
|
@ -47,14 +47,14 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
self.assertRaises(exceptions.Unauthorized,
|
||||
self.user_client.create_aggregate,
|
||||
aggregate_name)
|
||||
name=aggregate_name)
|
||||
|
||||
@test.attr(type=['negative', 'gate'])
|
||||
def test_aggregate_create_aggregate_name_length_less_than_1(self):
|
||||
# the length of aggregate name should >= 1 and <=255
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.client.create_aggregate,
|
||||
'')
|
||||
name='')
|
||||
|
||||
@test.attr(type=['negative', 'gate'])
|
||||
def test_aggregate_create_aggregate_name_length_exceeds_255(self):
|
||||
@ -62,25 +62,25 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
aggregate_name = 'a' * 256
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.client.create_aggregate,
|
||||
aggregate_name)
|
||||
name=aggregate_name)
|
||||
|
||||
@test.attr(type=['negative', 'gate'])
|
||||
def test_aggregate_create_with_existent_aggregate_name(self):
|
||||
# creating an aggregate with existent aggregate name is forbidden
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self.client.create_aggregate,
|
||||
aggregate_name)
|
||||
name=aggregate_name)
|
||||
|
||||
@test.attr(type=['negative', 'gate'])
|
||||
def test_aggregate_delete_as_user(self):
|
||||
# Regular user is not allowed to delete an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -98,7 +98,7 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_get_details_as_user(self):
|
||||
# Regular user is not allowed to get aggregate details.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -129,7 +129,7 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
break
|
||||
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
self.assertRaises(exceptions.NotFound, self.client.add_host,
|
||||
@ -139,7 +139,7 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_add_host_as_user(self):
|
||||
# Regular user is not allowed to add a host to an aggregate.
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -151,7 +151,7 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_add_existent_host(self):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
@ -167,7 +167,7 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
# Regular user is not allowed to remove a host from an aggregate.
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
resp, body = self.client.add_host(aggregate['id'], self.host)
|
||||
@ -182,7 +182,7 @@ class AggregatesAdminNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
|
||||
def test_aggregate_remove_nonexistent_host(self):
|
||||
non_exist_host = data_utils.rand_name('nonexist_host_')
|
||||
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
|
||||
resp, aggregate = self.client.create_aggregate(aggregate_name)
|
||||
resp, aggregate = self.client.create_aggregate(name=aggregate_name)
|
||||
self.assertEqual(201, resp.status)
|
||||
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
|
||||
|
||||
|
@ -36,9 +36,10 @@ class TestAggregatesBasicOps(manager.OfficialClientTest):
|
||||
def credentials(cls):
|
||||
return cls.admin_credentials()
|
||||
|
||||
def _create_aggregate(self, aggregate_name, availability_zone=None):
|
||||
aggregate = self.compute_client.aggregates.create(aggregate_name,
|
||||
availability_zone)
|
||||
def _create_aggregate(self, **kwargs):
|
||||
aggregate = self.compute_client.aggregates.create(**kwargs)
|
||||
aggregate_name = kwargs['name']
|
||||
availability_zone = kwargs['availability_zone']
|
||||
self.assertEqual(aggregate.name, aggregate_name)
|
||||
self.assertEqual(aggregate.availability_zone, availability_zone)
|
||||
self.set_resource(aggregate.id, aggregate)
|
||||
@ -107,7 +108,8 @@ class TestAggregatesBasicOps(manager.OfficialClientTest):
|
||||
self.useFixture(fixtures.LockFixture('availability_zone'))
|
||||
az = 'foo_zone'
|
||||
aggregate_name = rand_name('aggregate-scenario')
|
||||
aggregate = self._create_aggregate(aggregate_name, az)
|
||||
aggregate = self._create_aggregate(name=aggregate_name,
|
||||
availability_zone=az)
|
||||
|
||||
metadata = {'meta_key': 'meta_value'}
|
||||
self._set_aggregate_metadata(aggregate, metadata)
|
||||
|
@ -38,13 +38,9 @@ class AggregatesClientJSON(RestClient):
|
||||
body = json.loads(body)
|
||||
return resp, body['aggregate']
|
||||
|
||||
def create_aggregate(self, name, availability_zone=None):
|
||||
def create_aggregate(self, **kwargs):
|
||||
"""Creates a new aggregate."""
|
||||
post_body = {
|
||||
'name': name,
|
||||
'availability_zone': availability_zone,
|
||||
}
|
||||
post_body = json.dumps({'aggregate': post_body})
|
||||
post_body = json.dumps({'aggregate': kwargs})
|
||||
resp, body = self.post('os-aggregates', post_body, self.headers)
|
||||
|
||||
body = json.loads(body)
|
||||
|
@ -39,13 +39,9 @@ class AggregatesV3ClientJSON(RestClient):
|
||||
body = json.loads(body)
|
||||
return resp, body['aggregate']
|
||||
|
||||
def create_aggregate(self, name, availability_zone=None):
|
||||
def create_aggregate(self, **kwargs):
|
||||
"""Creates a new aggregate."""
|
||||
post_body = {
|
||||
'name': name,
|
||||
'availability_zone': availability_zone,
|
||||
}
|
||||
post_body = json.dumps({'aggregate': post_body})
|
||||
post_body = json.dumps({'aggregate': kwargs})
|
||||
resp, body = self.post('os-aggregates', post_body, self.headers)
|
||||
|
||||
body = json.loads(body)
|
||||
|
Loading…
Reference in New Issue
Block a user