Designate plugin fixes
1. Switch to v2 quatas schema 2. Remove v1 support Closes-Bug: 1884021 Closes-Bug: 1884022 Change-Id: If04f9ecef94d40e3e18180ca1c098a56aab7f5f6
This commit is contained in:
parent
996a7df22c
commit
d576ac96dd
@ -41,6 +41,11 @@ Fixed
|
||||
|
||||
`Launchpad-bug #1881456 <https://launchpad.net/bugs/1881456>`_
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
||||
* Remove deprecated api version 1 for designate
|
||||
|
||||
[2.0.0] - 2020-05-08
|
||||
--------------------
|
||||
|
||||
|
@ -4,143 +4,6 @@
|
||||
description: >
|
||||
This task contains various scenarios for testing designate plugins
|
||||
subtasks:
|
||||
-
|
||||
title: DesignateBasic.create_and_delete_domain tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_delete_domain: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_update_domain tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_update_domain: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_delete_records tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_delete_records:
|
||||
records_per_domain: 5
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_list_domains tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_list_domains: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_list_records tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_list_records:
|
||||
records_per_domain: 5
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.list_domains tests
|
||||
scenario:
|
||||
DesignateBasic.list_domains: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 3
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_list_servers tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_list_servers: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 1
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_delete_server tests
|
||||
scenario:
|
||||
DesignateBasic.create_and_delete_server: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 1
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.list_servers tests
|
||||
scenario:
|
||||
DesignateBasic.list_servers: {}
|
||||
runner:
|
||||
constant:
|
||||
times: 4
|
||||
concurrency: 2
|
||||
contexts:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 100
|
||||
-
|
||||
title: DesignateBasic.create_and_list_zones tests
|
||||
scenario:
|
||||
|
@ -678,7 +678,7 @@ class Murano(OSClient):
|
||||
|
||||
|
||||
@configure("designate", default_version="2", default_service_type="dns",
|
||||
supported_versions=["1", "2"])
|
||||
supported_versions=["2"])
|
||||
class Designate(OSClient):
|
||||
"""Wrapper for DesignateClient which returns authenticated native client.
|
||||
|
||||
@ -694,11 +694,8 @@ class Designate(OSClient):
|
||||
api_url += "/v%s" % version
|
||||
|
||||
session = self.keystone.get_session()[0]
|
||||
if version == "2":
|
||||
return client.Client(version, session=session,
|
||||
endpoint_override=api_url)
|
||||
return client.Client(version, session=session,
|
||||
endpoint=api_url)
|
||||
endpoint_override=api_url)
|
||||
|
||||
|
||||
@configure("trove", default_version="1.0", supported_versions=["1.0"],
|
||||
|
@ -20,15 +20,19 @@ class DesignateQuotas(object):
|
||||
"type": "object",
|
||||
"additionalProperties": False,
|
||||
"properties": {
|
||||
"domains": {
|
||||
"api_export_size": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"domain_recordsets": {
|
||||
"zones": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"domain_records": {
|
||||
"zones_recordsets": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"zones_records": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
|
@ -26,223 +26,6 @@ from rally_openstack.task.scenarios.designate import utils
|
||||
"""Basic scenarios for Designate."""
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_list_domains",
|
||||
platform="openstack")
|
||||
class CreateAndListDomains(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""Create a domain and list all domains.
|
||||
|
||||
Measure the "designate domain-list" command performance.
|
||||
|
||||
If you have only 1 user in your context, you will
|
||||
add 1 domain on every iteration. So you will have more
|
||||
and more domain and will be able to measure the
|
||||
performance of the "designate domain-list" command depending on
|
||||
the number of domains owned by users.
|
||||
"""
|
||||
domain = self._create_domain()
|
||||
msg = "Domain isn't created"
|
||||
self.assertTrue(domain, msg)
|
||||
list_domains = self._list_domains()
|
||||
self.assertIn(domain, list_domains)
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(name="DesignateBasic.list_domains",
|
||||
platform="openstack")
|
||||
class ListDomains(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""List Designate domains.
|
||||
|
||||
This simple scenario tests the designate domain-list command by listing
|
||||
all the domains.
|
||||
|
||||
Suppose if we have 2 users in context and each has 2 domains
|
||||
uploaded for them we will be able to test the performance of
|
||||
designate domain-list command in this case.
|
||||
"""
|
||||
self._list_domains()
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_delete_domain",
|
||||
platform="openstack")
|
||||
class CreateAndDeleteDomain(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""Create and then delete a domain.
|
||||
|
||||
Measure the performance of creating and deleting domains
|
||||
with different level of load.
|
||||
"""
|
||||
domain = self._create_domain()
|
||||
self._delete_domain(domain["id"])
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_update_domain",
|
||||
platform="openstack")
|
||||
class CreateAndUpdateDomain(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""Create and then update a domain.
|
||||
|
||||
Measure the performance of creating and updating domains
|
||||
with different level of load.
|
||||
"""
|
||||
domain = self._create_domain()
|
||||
self._update_domain(domain)
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_delete_records",
|
||||
platform="openstack")
|
||||
class CreateAndDeleteRecords(utils.DesignateScenario):
|
||||
|
||||
def run(self, records_per_domain=5):
|
||||
"""Create and then delete records.
|
||||
|
||||
Measure the performance of creating and deleting records
|
||||
with different level of load.
|
||||
|
||||
:param records_per_domain: Records to create pr domain.
|
||||
"""
|
||||
domain = self._create_domain()
|
||||
|
||||
records = []
|
||||
|
||||
for i in range(records_per_domain):
|
||||
record = self._create_record(domain)
|
||||
records.append(record)
|
||||
|
||||
for record in records:
|
||||
self._delete_record(
|
||||
domain["id"], record["id"])
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(name="DesignateBasic.list_records",
|
||||
platform="openstack")
|
||||
class ListRecords(utils.DesignateScenario):
|
||||
|
||||
def run(self, domain_id):
|
||||
"""List Designate records.
|
||||
|
||||
This simple scenario tests the designate record-list command by listing
|
||||
all the records in a domain.
|
||||
|
||||
Suppose if we have 2 users in context and each has 2 domains
|
||||
uploaded for them we will be able to test the performance of
|
||||
designate record-list command in this case.
|
||||
|
||||
:param domain_id: Domain ID
|
||||
"""
|
||||
|
||||
self._list_records(domain_id)
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_list_records",
|
||||
platform="openstack")
|
||||
class CreateAndListRecords(utils.DesignateScenario):
|
||||
|
||||
def run(self, records_per_domain=5):
|
||||
"""Create and then list records.
|
||||
|
||||
If you have only 1 user in your context, you will
|
||||
add 1 record on every iteration. So you will have more
|
||||
and more records and will be able to measure the
|
||||
performance of the "designate record-list" command depending on
|
||||
the number of domains/records owned by users.
|
||||
|
||||
:param records_per_domain: Records to create pr domain.
|
||||
"""
|
||||
domain = self._create_domain()
|
||||
for i in range(records_per_domain):
|
||||
self._create_record(domain)
|
||||
|
||||
self._list_records(domain["id"])
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_list_servers",
|
||||
platform="openstack")
|
||||
class CreateAndListServers(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""Create a Designate server and list all servers.
|
||||
|
||||
If you have only 1 user in your context, you will
|
||||
add 1 server on every iteration. So you will have more
|
||||
and more server and will be able to measure the
|
||||
performance of the "designate server-list" command depending on
|
||||
the number of servers owned by users.
|
||||
"""
|
||||
server = self._create_server()
|
||||
self.assertTrue(server)
|
||||
list_servers = self._list_servers()
|
||||
self.assertIn(server, list_servers)
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["designate"]},
|
||||
name="DesignateBasic.create_and_delete_server",
|
||||
platform="openstack")
|
||||
class CreateAndDeleteServer(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""Create and then delete a server.
|
||||
|
||||
Measure the performance of creating and deleting servers
|
||||
with different level of load.
|
||||
"""
|
||||
server = self._create_server()
|
||||
self._delete_server(server["id"])
|
||||
|
||||
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(name="DesignateBasic.list_servers", platform="openstack")
|
||||
class ListServers(utils.DesignateScenario):
|
||||
|
||||
def run(self):
|
||||
"""List Designate servers.
|
||||
|
||||
This simple scenario tests the designate server-list command by listing
|
||||
all the servers.
|
||||
"""
|
||||
self._list_servers()
|
||||
|
||||
|
||||
# NOTE: API V2
|
||||
@validation.add("required_services",
|
||||
services=[consts.Service.DESIGNATE])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
|
@ -26,103 +26,6 @@ class DesignateScenario(scenario.OpenStackScenario):
|
||||
# which are used in default autogenerated names
|
||||
RESOURCE_NAME_FORMAT = "s-rally-XXXXXXXX-XXXXXXXX"
|
||||
|
||||
@atomic.action_timer("designate.create_domain")
|
||||
def _create_domain(self, domain=None):
|
||||
"""Create domain.
|
||||
|
||||
:param domain: dict, POST /v1/domains request options
|
||||
:returns: designate domain dict
|
||||
"""
|
||||
domain = domain or {}
|
||||
|
||||
domain.setdefault("email", "root@random.name")
|
||||
domain["name"] = "%s.name." % self.generate_random_name()
|
||||
return self.clients("designate").domains.create(domain)
|
||||
|
||||
@atomic.action_timer("designate.list_domains")
|
||||
def _list_domains(self):
|
||||
"""Return user domain list."""
|
||||
return self.clients("designate").domains.list()
|
||||
|
||||
@atomic.action_timer("designate.delete_domain")
|
||||
def _delete_domain(self, domain_id):
|
||||
"""Delete designate zone.
|
||||
|
||||
:param domain_id: domain ID
|
||||
"""
|
||||
self.clients("designate").domains.delete(domain_id)
|
||||
|
||||
@atomic.action_timer("designate.update_domain")
|
||||
def _update_domain(self, domain):
|
||||
"""Update designate domain.
|
||||
|
||||
:param domain: designate domain
|
||||
:returns: designate updated domain dict
|
||||
"""
|
||||
domain["description"] = "updated domain"
|
||||
domain["email"] = "updated@random.name"
|
||||
return self.clients("designate").domains.update(domain)
|
||||
|
||||
@atomic.action_timer("designate.create_record")
|
||||
def _create_record(self, domain, record=None):
|
||||
"""Create a record in a domain.
|
||||
|
||||
:param domain: domain dict
|
||||
:param record: record dict
|
||||
:returns: Designate record dict
|
||||
"""
|
||||
record = record or {}
|
||||
record.setdefault("type", "A")
|
||||
record["name"] = "%s.%s" % (self.generate_random_name(),
|
||||
domain["name"])
|
||||
record.setdefault("data", "10.0.0.1")
|
||||
|
||||
return self.clients("designate").records.create(domain["id"], record)
|
||||
|
||||
@atomic.action_timer("designate.list_records")
|
||||
def _list_records(self, domain_id):
|
||||
"""List domain records.
|
||||
|
||||
:param domain_id: domain ID
|
||||
:returns: domain records list
|
||||
"""
|
||||
return self.clients("designate").records.list(domain_id)
|
||||
|
||||
@atomic.action_timer("designate.delete_record")
|
||||
def _delete_record(self, domain_id, record_id):
|
||||
"""Delete a domain record.
|
||||
|
||||
:param domain_id: domain ID
|
||||
:param record_id: record ID
|
||||
"""
|
||||
self.clients("designate").records.delete(domain_id, record_id)
|
||||
|
||||
@atomic.action_timer("designate.create_server")
|
||||
def _create_server(self, server=None):
|
||||
"""Create server.
|
||||
|
||||
:param server: dict, POST /v1/servers request options
|
||||
:returns: designate server dict
|
||||
"""
|
||||
server = server or {}
|
||||
|
||||
server["name"] = "%s.name." % self.generate_random_name()
|
||||
return self.admin_clients("designate").servers.create(server)
|
||||
|
||||
@atomic.action_timer("designate.list_servers")
|
||||
def _list_servers(self):
|
||||
"""Return user server list."""
|
||||
return self.admin_clients("designate").servers.list()
|
||||
|
||||
@atomic.action_timer("designate.delete_server")
|
||||
def _delete_server(self, server_id):
|
||||
"""Delete Server.
|
||||
|
||||
:param server_id: unicode server ID
|
||||
"""
|
||||
self.admin_clients("designate").servers.delete(server_id)
|
||||
|
||||
# NOTE: API V2
|
||||
@atomic.action_timer("designate.create_zone")
|
||||
def _create_zone(self, name=None, type_=None, email=None, description=None,
|
||||
ttl=None):
|
||||
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_delete_domain": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 500,
|
||||
"domain_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_delete_domain:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 500
|
||||
domain_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_delete_records": [
|
||||
{
|
||||
"args": {
|
||||
"records_per_domain": 10
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 2000,
|
||||
"domain_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_delete_records:
|
||||
-
|
||||
args:
|
||||
records_per_domain: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 2000
|
||||
domain_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -12,9 +12,9 @@
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 2000,
|
||||
"domain_records": 2000,
|
||||
"zones": 100,
|
||||
"zones_recordsets": 2000,
|
||||
"zones_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
|
@ -10,9 +10,9 @@
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 2000
|
||||
domain_records: 2000
|
||||
zones: 100
|
||||
zones_recordsets: 2000
|
||||
zones_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_delete_server": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 1
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_delete_server:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -9,9 +9,9 @@
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 500,
|
||||
"domain_records": 2000,
|
||||
"zones": 100,
|
||||
"zones_recordsets": 500,
|
||||
"zones_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
|
@ -8,9 +8,9 @@
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 500
|
||||
domain_records: 2000
|
||||
zones: 100
|
||||
zones_recordsets: 500
|
||||
zones_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_list_domains": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 500,
|
||||
"domain_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_list_domains:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 500
|
||||
domain_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_list_records": [
|
||||
{
|
||||
"args": {
|
||||
"records_per_domain": 10
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 2000,
|
||||
"domain_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_list_records:
|
||||
-
|
||||
args:
|
||||
records_per_domain: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 2000
|
||||
domain_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -12,9 +12,9 @@
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 2000,
|
||||
"domain_records": 2000,
|
||||
"zones": 100,
|
||||
"zones_recordsets": 2000,
|
||||
"zones_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
|
@ -10,9 +10,9 @@
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 2000
|
||||
domain_records: 2000
|
||||
zones: 100
|
||||
zones_recordsets: 2000
|
||||
zones_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_list_servers": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 1
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_list_servers:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -9,9 +9,9 @@
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 500,
|
||||
"domain_records": 2000,
|
||||
"zones": 100,
|
||||
"zones_recordsets": 500,
|
||||
"zones_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
|
@ -8,9 +8,9 @@
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 500
|
||||
domain_records: 2000
|
||||
zones: 100
|
||||
zones_recordsets: 500
|
||||
zones_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.create_and_update_domain": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"designate": {
|
||||
"domains": 100,
|
||||
"domain_recordsets": 500,
|
||||
"domain_records": 2000,
|
||||
"recordset_records": 2000
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
DesignateBasic.create_and_update_domain:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
quotas:
|
||||
designate:
|
||||
domains: 100
|
||||
domain_recordsets: 500
|
||||
domain_records: 2000
|
||||
recordset_records: 2000
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.list_domains": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 3,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
DesignateBasic.list_domains:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 3
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.list_records": [
|
||||
{
|
||||
"args": {
|
||||
"domain_id": "<uuid>"
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 3,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
---
|
||||
DesignateBasic.list_records:
|
||||
-
|
||||
args:
|
||||
domain_id: <uuid>
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 3
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"DesignateBasic.list_servers": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 3,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
DesignateBasic.list_servers:
|
||||
-
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 3
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -911,7 +911,6 @@ class OSClientsTestCase(test.TestCase):
|
||||
@ddt.data(
|
||||
{},
|
||||
{"version": "2"},
|
||||
{"version": "1"},
|
||||
{"version": None}
|
||||
)
|
||||
@ddt.unpack
|
||||
@ -944,16 +943,10 @@ class OSClientsTestCase(test.TestCase):
|
||||
|
||||
mock_keystone_get_session.assert_called_once_with()
|
||||
|
||||
if version == "2":
|
||||
mock_designate.client.Client.assert_called_once_with(
|
||||
version,
|
||||
endpoint_override=url.__iadd__.return_value,
|
||||
session="fake_session")
|
||||
elif version == "1":
|
||||
mock_designate.client.Client.assert_called_once_with(
|
||||
version,
|
||||
endpoint=url.__iadd__.return_value,
|
||||
session="fake_session")
|
||||
mock_designate.client.Client.assert_called_once_with(
|
||||
default,
|
||||
endpoint_override=url.__iadd__.return_value,
|
||||
session="fake_session")
|
||||
|
||||
key = "designate"
|
||||
if version is not None:
|
||||
|
@ -25,9 +25,10 @@ class DesignateQuotasTestCase(test.TestCase):
|
||||
quotas = designate_quotas.DesignateQuotas(clients)
|
||||
tenant_id = mock.MagicMock()
|
||||
quotas_values = {
|
||||
"domains": 5,
|
||||
"domain_recordsets": 20,
|
||||
"domain_records": 20,
|
||||
"api_export_size": 5,
|
||||
"zones": 5,
|
||||
"zones_recordsets": 20,
|
||||
"zones_records": 20,
|
||||
"recordset_records": 20,
|
||||
}
|
||||
quotas.update(tenant_id, **quotas_values)
|
||||
@ -43,7 +44,8 @@ class DesignateQuotasTestCase(test.TestCase):
|
||||
|
||||
def test_get(self):
|
||||
tenant_id = "tenant_id"
|
||||
quotas = {"domains": -1, "domain_recordsets": 2, "domain_records": 3,
|
||||
quotas = {"api_export_size": -1, "zones": -1,
|
||||
"zones_recordsets": 2, "zones_records": 3,
|
||||
"recordset_records": 3}
|
||||
clients = mock.MagicMock()
|
||||
clients.designate.return_value.quotas.get.return_value = quotas
|
||||
|
@ -25,171 +25,6 @@ BASE = "rally_openstack.task.scenarios.designate.basic"
|
||||
|
||||
class DesignateBasicTestCase(test.ScenarioTestCase):
|
||||
|
||||
@mock.patch("%s.CreateAndListDomains._list_domains" % BASE)
|
||||
@mock.patch("%s.CreateAndListDomains._create_domain" % BASE)
|
||||
def test_create_and_list_domains(self,
|
||||
mock__create_domain,
|
||||
mock__list_domains):
|
||||
mock__create_domain.return_value = "fake_domain.xyz"
|
||||
mock__list_domains.return_value = (["fake_domain.org",
|
||||
"fake_domain.xyz",
|
||||
"ultimate_question.net"])
|
||||
basic.CreateAndListDomains(self.context).run()
|
||||
mock__create_domain.assert_called_once_with()
|
||||
mock__list_domains.assert_called_once_with()
|
||||
|
||||
@mock.patch("%s.CreateAndListDomains._list_domains" % BASE)
|
||||
@mock.patch("%s.CreateAndListDomains._create_domain" % BASE)
|
||||
def test_create_and_list_domains_fails(self,
|
||||
mock__create_domain,
|
||||
mock__list_domains):
|
||||
mock__list_domains.return_value = (["fake_domain.org",
|
||||
"fake_domain.xyz",
|
||||
"ultimate_question.net"])
|
||||
scenario = basic.CreateAndListDomains(self.context)
|
||||
self.assertRaises(exceptions.RallyAssertionError, scenario.run)
|
||||
mock__create_domain.assert_called_once_with()
|
||||
|
||||
mock__create_domain.return_value = "fake_not_existed_domain.xyz"
|
||||
self.assertRaises(exceptions.RallyAssertionError, scenario.run)
|
||||
mock__create_domain.assert_called_with()
|
||||
mock__list_domains.assert_called_with()
|
||||
|
||||
@mock.patch("%s.CreateAndDeleteDomain._delete_domain" % BASE)
|
||||
@mock.patch("%s.CreateAndDeleteDomain._create_domain" % BASE,
|
||||
return_value={"id": "123"})
|
||||
def test_create_and_delete_domain(self,
|
||||
mock__create_domain,
|
||||
mock__delete_domain):
|
||||
|
||||
basic.CreateAndDeleteDomain(self.context).run()
|
||||
|
||||
mock__create_domain.assert_called_once_with()
|
||||
mock__delete_domain.assert_called_once_with("123")
|
||||
|
||||
@mock.patch("%s.CreateAndUpdateDomain._update_domain" % BASE)
|
||||
@mock.patch("%s.CreateAndUpdateDomain._create_domain" % BASE)
|
||||
def test_create_and_update_domain(self,
|
||||
mock__create_domain,
|
||||
mock__update_domain):
|
||||
domain = {
|
||||
"name": "zone.name",
|
||||
"email": "email@zone.name",
|
||||
"id": "123"}
|
||||
mock__create_domain.return_value = domain
|
||||
basic.CreateAndUpdateDomain(self.context).run()
|
||||
mock__update_domain.assert_called_once_with(domain)
|
||||
|
||||
@mock.patch("%s.ListDomains._list_domains" % BASE)
|
||||
def test_list_domains(self, mock__list_domains):
|
||||
basic.ListDomains(self.context).run()
|
||||
mock__list_domains.assert_called_once_with()
|
||||
|
||||
@mock.patch("%s.CreateAndListRecords._list_records" % BASE)
|
||||
@mock.patch("%s.CreateAndListRecords._create_record" % BASE)
|
||||
@mock.patch("%s.CreateAndListRecords._create_domain" % BASE)
|
||||
def test_create_and_list_records(self,
|
||||
mock__create_domain,
|
||||
mock__create_record,
|
||||
mock__list_records):
|
||||
domain = {
|
||||
"name": "zone.name",
|
||||
"email": "email@zone.name",
|
||||
"id": "123"}
|
||||
mock__create_domain.return_value = domain
|
||||
records_per_domain = 5
|
||||
return_value = mock.call(domain)
|
||||
mock__create_record.return_value = return_value
|
||||
mock__list_records.return_value = [return_value] * records_per_domain
|
||||
|
||||
basic.CreateAndListRecords(self.context).run(
|
||||
records_per_domain=records_per_domain)
|
||||
mock__create_domain.assert_called_once_with()
|
||||
|
||||
self.assertEqual(mock__create_record.mock_calls,
|
||||
[return_value]
|
||||
* records_per_domain)
|
||||
mock__list_records.assert_called_once_with(domain["id"])
|
||||
|
||||
@mock.patch("%s.CreateAndDeleteRecords._delete_record" % BASE)
|
||||
@mock.patch("%s.CreateAndDeleteRecords._create_record" % BASE)
|
||||
@mock.patch("%s.CreateAndDeleteRecords._create_domain" % BASE)
|
||||
def test_create_and_delete_records(self,
|
||||
mock__create_domain,
|
||||
mock__create_record,
|
||||
mock__delete_record):
|
||||
domain = {
|
||||
"name": "zone.name",
|
||||
"email": "email@zone.name",
|
||||
"id": "123"}
|
||||
mock__create_domain.return_value = domain
|
||||
mock__create_record.return_value = {"id": "321"}
|
||||
records_per_domain = 5
|
||||
|
||||
basic.CreateAndDeleteRecords(self.context).run(
|
||||
records_per_domain=records_per_domain)
|
||||
mock__create_domain.assert_called_once_with()
|
||||
self.assertEqual(mock__create_record.mock_calls,
|
||||
[mock.call(domain)]
|
||||
* records_per_domain)
|
||||
self.assertEqual(mock__delete_record.mock_calls,
|
||||
[mock.call(domain["id"],
|
||||
"321")]
|
||||
* records_per_domain)
|
||||
|
||||
@mock.patch("%s.ListRecords._list_records" % BASE)
|
||||
def test_list_records(self, mock__list_records):
|
||||
basic.ListRecords(self.context).run("123")
|
||||
mock__list_records.assert_called_once_with("123")
|
||||
|
||||
@mock.patch("%s.CreateAndListServers._list_servers" % BASE)
|
||||
@mock.patch("%s.CreateAndListServers._create_server" % BASE)
|
||||
def test_create_and_list_servers(self,
|
||||
mock__create_server,
|
||||
mock__list_servers):
|
||||
mock__create_server.return_value = "fake_server"
|
||||
mock__list_servers.return_value = ["fake_srv1",
|
||||
"fake_srv2",
|
||||
"fake_server"]
|
||||
|
||||
# Positive case:
|
||||
basic.CreateAndListServers(self.context).run()
|
||||
|
||||
mock__create_server.assert_called_once_with()
|
||||
mock__list_servers.assert_called_once_with()
|
||||
|
||||
# Negative case: server isn't created
|
||||
mock__create_server.return_value = None
|
||||
self.assertRaises(exceptions.RallyAssertionError,
|
||||
basic.CreateAndListServers(self.context).run)
|
||||
|
||||
mock__create_server.assert_called_with()
|
||||
|
||||
# Negative case: server not found in the list of existed servers
|
||||
mock__create_server.return_value = "The_main_server_of_the_universe"
|
||||
self.assertRaises(exceptions.RallyAssertionError,
|
||||
basic.CreateAndListServers(self.context).run)
|
||||
|
||||
mock__create_server.assert_called_with()
|
||||
mock__list_servers.assert_called_with()
|
||||
|
||||
@mock.patch("%s.CreateAndDeleteServer._delete_server" % BASE)
|
||||
@mock.patch("%s.CreateAndDeleteServer._create_server" % BASE,
|
||||
return_value={"id": "123"})
|
||||
def test_create_and_delete_server(self,
|
||||
mock__create_server,
|
||||
mock__delete_server):
|
||||
basic.CreateAndDeleteServer(self.context).run()
|
||||
|
||||
mock__create_server.assert_called_once_with()
|
||||
mock__delete_server.assert_called_once_with("123")
|
||||
|
||||
@mock.patch("%s.ListServers._list_servers" % BASE)
|
||||
def test_list_servers(self, mock__list_servers):
|
||||
basic.ListServers(self.context).run()
|
||||
mock__list_servers.assert_called_once_with()
|
||||
|
||||
# NOTE: API V2
|
||||
@mock.patch("%s.CreateAndListZones._list_zones" % BASE)
|
||||
@mock.patch("%s.CreateAndListZones._create_zone" % BASE)
|
||||
def test_create_and_list_zones(self,
|
||||
|
@ -38,131 +38,9 @@ class DesignateScenarioTestCase(test.ScenarioTestCase):
|
||||
@ddt.data(
|
||||
{},
|
||||
{"email": "root@zone.name"})
|
||||
def test_create_domain(self, domain_data):
|
||||
random_name = "foo"
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
scenario.generate_random_name = mock.Mock(return_value=random_name)
|
||||
self.clients("designate").domains.create.return_value = self.domain
|
||||
expected = {"email": "root@random.name"}
|
||||
expected.update(domain_data)
|
||||
expected["name"] = "%s.name." % random_name
|
||||
|
||||
domain = scenario._create_domain(domain_data)
|
||||
self.clients("designate").domains.create.assert_called_once_with(
|
||||
expected)
|
||||
self.assertEqual(self.domain, domain)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.create_domain")
|
||||
|
||||
def test_list_domains(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
return_domains_list = scenario._list_domains()
|
||||
self.assertEqual(self.clients("designate").domains.list.return_value,
|
||||
return_domains_list)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.list_domains")
|
||||
|
||||
def test_delete_domain(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
|
||||
domain = scenario._create_domain()
|
||||
scenario._delete_domain(domain["id"])
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.delete_domain")
|
||||
|
||||
def test_update_domain(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
domain = scenario._create_domain()
|
||||
self.clients("designate").domains.update.return_value = self.domain
|
||||
updated_domain = scenario._update_domain(domain)
|
||||
self.clients("designate").domains.update.assert_called_once_with(
|
||||
domain)
|
||||
self.assertEqual(self.domain, updated_domain)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.update_domain")
|
||||
|
||||
@ddt.data(
|
||||
{},
|
||||
{"data": "127.0.0.1"})
|
||||
def test_create_record(self, record_data):
|
||||
random_name = "foo"
|
||||
domain_name = "zone.name."
|
||||
domain = {"name": domain_name, "id": "123"}
|
||||
record_name = "%s.%s" % (random_name, domain_name)
|
||||
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
scenario.generate_random_name = mock.Mock(return_value=random_name)
|
||||
|
||||
expected = {"type": "A", "data": "10.0.0.1"}
|
||||
expected.update(record_data)
|
||||
expected["name"] = record_name
|
||||
|
||||
scenario._create_record(domain, record=record_data)
|
||||
self.clients("designate").records.create.assert_called_once_with(
|
||||
domain["id"], expected)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.create_record")
|
||||
|
||||
def test_list_records(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
return_records_list = scenario._list_records("123")
|
||||
self.assertEqual(self.clients("designate").records.list.return_value,
|
||||
return_records_list)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.list_records")
|
||||
|
||||
def test_delete_record(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
|
||||
domain_id = mock.Mock()
|
||||
record_id = mock.Mock()
|
||||
scenario._delete_record(domain_id, record_id)
|
||||
self.clients("designate").records.delete.assert_called_once_with(
|
||||
domain_id, record_id)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.delete_record")
|
||||
|
||||
self.clients("designate").records.delete.reset_mock()
|
||||
scenario._delete_record(domain_id, record_id)
|
||||
self.clients("designate").records.delete.assert_called_once_with(
|
||||
domain_id, record_id)
|
||||
|
||||
def test_create_server(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
random_name = "foo"
|
||||
scenario.generate_random_name = mock.Mock(return_value=random_name)
|
||||
|
||||
explicit_name = "bar.io."
|
||||
|
||||
self.admin_clients(
|
||||
"designate").servers.create.return_value = self.server
|
||||
|
||||
# Check that the defaults / randoms are used if nothing is specified
|
||||
server = scenario._create_server()
|
||||
self.admin_clients("designate").servers.create.assert_called_once_with(
|
||||
{"name": "%s.name." % random_name})
|
||||
self.assertEqual(self.server, server)
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.create_server")
|
||||
|
||||
self.admin_clients("designate").servers.create.reset_mock()
|
||||
|
||||
# Check that when specifying server name defaults are not used...
|
||||
data = {"name": explicit_name}
|
||||
server = scenario._create_server(data)
|
||||
self.admin_clients(
|
||||
"designate").servers.create.assert_called_once_with(data)
|
||||
self.assertEqual(self.server, server)
|
||||
|
||||
def test_delete_server(self):
|
||||
scenario = utils.DesignateScenario(context=self.context)
|
||||
|
||||
scenario._delete_server("foo_id")
|
||||
self.admin_clients("designate").servers.delete.assert_called_once_with(
|
||||
"foo_id")
|
||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||
"designate.delete_server")
|
||||
|
||||
# NOTE: API V2
|
||||
@ddt.data(
|
||||
{},
|
||||
|
Loading…
x
Reference in New Issue
Block a user