Fix Designate Plugins
- Fix all bugs in cleanup: Removing copy paste, fixing lists, getting id and name methods Fixing deleting method in case of subresources. Delete Designate Recrods as well - Use proper versions of clients in osresources check - Reduce concurency and amount of iterations in CI - Remove assertations Change-Id: I98f61c647051b3f5ce9910d9e613d38450a58b4b
This commit is contained in:
parent
fe0dc3bbb3
commit
cca8c0394f
@ -3,8 +3,8 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 10
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
tenants: 2
|
tenants: 2
|
||||||
@ -17,8 +17,8 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 10
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
tenants: 2
|
tenants: 2
|
||||||
@ -30,11 +30,11 @@
|
|||||||
DesignateBasic.create_and_delete_records:
|
DesignateBasic.create_and_delete_records:
|
||||||
-
|
-
|
||||||
args:
|
args:
|
||||||
records_per_domain: 10
|
records_per_domain: 5
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 10
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
tenants: 2
|
tenants: 2
|
||||||
@ -47,8 +47,8 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 10
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
tenants: 2
|
tenants: 2
|
||||||
@ -60,11 +60,11 @@
|
|||||||
DesignateBasic.create_and_list_records:
|
DesignateBasic.create_and_list_records:
|
||||||
-
|
-
|
||||||
args:
|
args:
|
||||||
records_per_domain: 10
|
records_per_domain: 5
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 10
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
tenants: 2
|
tenants: 2
|
||||||
@ -91,7 +91,7 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 1
|
concurrency: 1
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
@ -105,7 +105,7 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 1
|
concurrency: 1
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
@ -133,7 +133,7 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 2
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
@ -147,7 +147,7 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 2
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
@ -161,7 +161,7 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 2
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
@ -177,7 +177,7 @@
|
|||||||
-
|
-
|
||||||
runner:
|
runner:
|
||||||
type: "constant"
|
type: "constant"
|
||||||
times: 10
|
times: 4
|
||||||
concurrency: 2
|
concurrency: 2
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
|
@ -691,76 +691,69 @@ class ZaqarQueues(SynchronizedDeletion, base.ResourceManager):
|
|||||||
|
|
||||||
|
|
||||||
# DESIGNATE
|
# DESIGNATE
|
||||||
|
|
||||||
_designate_order = get_order(900)
|
_designate_order = get_order(900)
|
||||||
|
|
||||||
|
|
||||||
class DesignateResource(SynchronizedDeletion, base.ResourceManager):
|
class DesignateResource(SynchronizedDeletion, base.ResourceManager):
|
||||||
def _manager(self):
|
|
||||||
|
# TODO(boris-42): This should be handled somewhere else.
|
||||||
|
NAME_PREFIX = "s_rally_"
|
||||||
|
|
||||||
|
def _manager(self, resource=None):
|
||||||
# Map resource names to api / client version
|
# Map resource names to api / client version
|
||||||
resource_versions = {
|
resource = resource or self._resource
|
||||||
|
version = {
|
||||||
"domains": "1",
|
"domains": "1",
|
||||||
"servers": "1",
|
"servers": "1",
|
||||||
"recordsets": 2,
|
"records": "1",
|
||||||
|
"recordsets": "2",
|
||||||
"zones": "2"
|
"zones": "2"
|
||||||
}
|
}[resource]
|
||||||
version = resource_versions[self._resource]
|
|
||||||
return getattr(getattr(self.user, self._service)(version),
|
|
||||||
self._resource)
|
|
||||||
|
|
||||||
def _walk_pages(self, func, *args, **kwargs):
|
client = self._admin_required and self.admin or self.user
|
||||||
"""Generator that keeps fetching pages until there's none left."""
|
return getattr(getattr(client, self._service)(version), resource)
|
||||||
marker = None
|
|
||||||
|
|
||||||
while True:
|
def id(self):
|
||||||
items = func(marker=marker, limit=100, *args, **kwargs)
|
"""Returns id of resource."""
|
||||||
if not items:
|
return self.raw_resource["id"]
|
||||||
break
|
|
||||||
for item in items:
|
def name(self):
|
||||||
yield item
|
"""Returns name of resource."""
|
||||||
marker = items[-1]["id"]
|
return self.raw_resource["name"]
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return [item for item in self._manager().list()
|
||||||
|
if item["name"].startswith(self.NAME_PREFIX)]
|
||||||
|
|
||||||
|
|
||||||
@base.resource("designate", "domains", order=next(_designate_order))
|
@base.resource("designate", "domains", order=next(_designate_order),
|
||||||
|
tenant_resource=True, threads=1)
|
||||||
class DesignateDomain(DesignateResource):
|
class DesignateDomain(DesignateResource):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@base.resource("designate", "servers", order=next(_designate_order),
|
@base.resource("designate", "servers", order=next(_designate_order),
|
||||||
admin_required=True, perform_for_admin_only=True)
|
admin_required=True, perform_for_admin_only=True, threads=1)
|
||||||
class DesignateServer(DesignateResource):
|
class DesignateServer(DesignateResource):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@base.resource("designate", "recordsets", order=next(_designate_order),
|
|
||||||
tenant_resource=True)
|
|
||||||
class DesignateRecordSets(DesignateResource):
|
|
||||||
def _client(self):
|
|
||||||
# Map resource names to api / client version
|
|
||||||
resource_versions = {
|
|
||||||
"domains": "1",
|
|
||||||
"servers": "1",
|
|
||||||
"recordsets": 2,
|
|
||||||
"zones": "2"
|
|
||||||
}
|
|
||||||
version = resource_versions[self._resource]
|
|
||||||
return getattr(self.user, self._service)(version)
|
|
||||||
|
|
||||||
def list(self):
|
|
||||||
criterion = {"name": "s_rally_*"}
|
|
||||||
for zone in self._walk_pages(self._client().zones.list,
|
|
||||||
criterion=criterion):
|
|
||||||
for recordset in self._walk_pages(self._client().recordsets.list,
|
|
||||||
zone["id"]):
|
|
||||||
yield recordset
|
|
||||||
|
|
||||||
|
|
||||||
@base.resource("designate", "zones", order=next(_designate_order),
|
@base.resource("designate", "zones", order=next(_designate_order),
|
||||||
tenant_resource=True)
|
tenant_resource=True, threads=1)
|
||||||
class DesignateZones(DesignateResource):
|
class DesignateZones(DesignateResource):
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
criterion = {"name": "s_rally_*"}
|
marker = None
|
||||||
return self._walk_pages(self._manager().list, criterion=criterion)
|
criterion = {"name": "%s*" % self.NAME_PREFIX}
|
||||||
|
|
||||||
|
while True:
|
||||||
|
items = self._manager().list(marker=marker, limit=100,
|
||||||
|
criterion=criterion)
|
||||||
|
if not items:
|
||||||
|
break
|
||||||
|
for item in items:
|
||||||
|
yield item
|
||||||
|
marker = items[-1]["id"]
|
||||||
|
|
||||||
|
|
||||||
# SWIFT
|
# SWIFT
|
||||||
|
@ -173,14 +173,10 @@ class CreateAndListRecords(utils.DesignateScenario):
|
|||||||
:param records_per_domain: Records to create pr domain.
|
:param records_per_domain: Records to create pr domain.
|
||||||
"""
|
"""
|
||||||
domain = self._create_domain()
|
domain = self._create_domain()
|
||||||
|
|
||||||
records = []
|
|
||||||
for i in range(records_per_domain):
|
for i in range(records_per_domain):
|
||||||
records.append(
|
self._create_record(domain)
|
||||||
self._create_record(domain))
|
|
||||||
|
|
||||||
list_records = self._list_records(domain["id"])
|
self._list_records(domain["id"])
|
||||||
self.assertEqual(records, list_records)
|
|
||||||
|
|
||||||
|
|
||||||
@validation.add("required_services",
|
@validation.add("required_services",
|
||||||
|
@ -72,9 +72,7 @@ class DesignateScenario(scenario.OpenStackScenario):
|
|||||||
domain["name"])
|
domain["name"])
|
||||||
record.setdefault("data", "10.0.0.1")
|
record.setdefault("data", "10.0.0.1")
|
||||||
|
|
||||||
client = self.clients("designate")
|
return self.clients("designate").records.create(domain["id"], record)
|
||||||
|
|
||||||
return client.records.create(domain["id"], record)
|
|
||||||
|
|
||||||
@atomic.action_timer("designate.list_records")
|
@atomic.action_timer("designate.list_records")
|
||||||
def _list_records(self, domain_id):
|
def _list_records(self, domain_id):
|
||||||
@ -103,7 +101,7 @@ class DesignateScenario(scenario.OpenStackScenario):
|
|||||||
"""
|
"""
|
||||||
server = server or {}
|
server = server or {}
|
||||||
|
|
||||||
server["name"] = "name.%s." % self.generate_random_name()
|
server["name"] = "%s.name." % self.generate_random_name()
|
||||||
return self.admin_clients("designate").servers.create(server)
|
return self.admin_clients("designate").servers.create(server)
|
||||||
|
|
||||||
@atomic.action_timer("designate.list_servers")
|
@atomic.action_timer("designate.list_servers")
|
||||||
|
@ -365,13 +365,14 @@ class Designate(ResourceManager):
|
|||||||
return self.client.servers.list()
|
return self.client.servers.list()
|
||||||
|
|
||||||
def list_zones(self):
|
def list_zones(self):
|
||||||
return self.client.zones.list()
|
return self.clients.designate("2").zones.list()
|
||||||
|
|
||||||
def list_recordset(self):
|
def list_recordset(self):
|
||||||
result = []
|
client = self.clients.designate("2")
|
||||||
result.extend(self.client.recordsets.list(zone_id)
|
results = []
|
||||||
for zone_id in self.client.zones.list())
|
results.extend(client.recordsets.list(zone_id)
|
||||||
return result
|
for zone_id in client.zones.list())
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
class Trove(ResourceManager):
|
class Trove(ResourceManager):
|
||||||
|
@ -139,7 +139,7 @@ class DesignateScenarioTestCase(test.ScenarioTestCase):
|
|||||||
# Check that the defaults / randoms are used if nothing is specified
|
# Check that the defaults / randoms are used if nothing is specified
|
||||||
server = scenario._create_server()
|
server = scenario._create_server()
|
||||||
self.admin_clients("designate").servers.create.assert_called_once_with(
|
self.admin_clients("designate").servers.create.assert_called_once_with(
|
||||||
{"name": "name.%s." % random_name})
|
{"name": "%s.name." % random_name})
|
||||||
self.assertEqual(self.server, server)
|
self.assertEqual(self.server, server)
|
||||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||||
"designate.create_server")
|
"designate.create_server")
|
||||||
|
Loading…
Reference in New Issue
Block a user