Adds Designate domain-update test
This submission adds create_and_update_domain method to rally/benchmark/scenarios/designate/basic.py. Adds update method to "utils.py" under "rally/benchmark/scenarios/designate". Added configuration files for designate update-domain operation under samples/tasks/scenarios/designate. 1) create-and-update-domain.json 2) create-and-update-domain.yaml Also added unit tests to 'test_basic.py' and 'test_utils.py' under 'rally/tests/unit/plugins/openstack/scenarios/designate'. Change-Id: I58468666c0eb73143a0a451466ba41d12a9076d6
This commit is contained in:
@@ -13,6 +13,20 @@
|
|||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
|
|
||||||
|
DesignateBasic.create_and_update_domain:
|
||||||
|
-
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 10
|
||||||
|
concurrency: 10
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 2
|
||||||
|
users_per_tenant: 2
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
|
|
||||||
DesignateBasic.create_and_delete_records:
|
DesignateBasic.create_and_delete_records:
|
||||||
-
|
-
|
||||||
args:
|
args:
|
||||||
|
|||||||
@@ -69,6 +69,18 @@ class DesignateBasic(utils.DesignateScenario):
|
|||||||
domain = self._create_domain()
|
domain = self._create_domain()
|
||||||
self._delete_domain(domain["id"])
|
self._delete_domain(domain["id"])
|
||||||
|
|
||||||
|
@validation.required_services(consts.Service.DESIGNATE)
|
||||||
|
@validation.required_openstack(users=True)
|
||||||
|
@scenario.configure(context={"cleanup": ["designate_v1"]})
|
||||||
|
def create_and_update_domain(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.required_services(consts.Service.DESIGNATE)
|
@validation.required_services(consts.Service.DESIGNATE)
|
||||||
@validation.required_openstack(users=True)
|
@validation.required_openstack(users=True)
|
||||||
@scenario.configure(context={"cleanup": ["designate_v1"]})
|
@scenario.configure(context={"cleanup": ["designate_v1"]})
|
||||||
|
|||||||
@@ -47,6 +47,17 @@ class DesignateScenario(scenario.OpenStackScenario):
|
|||||||
"""
|
"""
|
||||||
self.clients("designate").domains.delete(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.optional_action_timer("designate.create_record")
|
@atomic.optional_action_timer("designate.create_record")
|
||||||
def _create_record(self, domain, record=None):
|
def _create_record(self, domain, record=None):
|
||||||
"""Create a record in a domain.
|
"""Create a record in a domain.
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
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
|
||||||
@@ -52,6 +52,21 @@ class DesignateBasicTestCase(test.ScenarioTestCase):
|
|||||||
mock_designate_basic__create_domain.assert_called_once_with()
|
mock_designate_basic__create_domain.assert_called_once_with()
|
||||||
mock_designate_basic__delete_domain.assert_called_once_with("123")
|
mock_designate_basic__delete_domain.assert_called_once_with("123")
|
||||||
|
|
||||||
|
@mock.patch(DESIGNATE_BASIC + "._update_domain")
|
||||||
|
@mock.patch(DESIGNATE_BASIC + "._create_domain")
|
||||||
|
def test_create_and_update_domain(
|
||||||
|
self, mock_designate_basic__create_domain,
|
||||||
|
mock_designate_basic__update_domain):
|
||||||
|
|
||||||
|
scenario = basic.DesignateBasic(self.context)
|
||||||
|
domain = {
|
||||||
|
"name": "zone.name",
|
||||||
|
"email": "email@zone.name",
|
||||||
|
"id": "123"}
|
||||||
|
mock_designate_basic__create_domain.return_value = domain
|
||||||
|
scenario.create_and_update_domain()
|
||||||
|
mock_designate_basic__update_domain.assert_called_once_with(domain)
|
||||||
|
|
||||||
@mock.patch(DESIGNATE_BASIC + "._list_domains")
|
@mock.patch(DESIGNATE_BASIC + "._list_domains")
|
||||||
def test_list_domains(self, mock_designate_basic__list_domains):
|
def test_list_domains(self, mock_designate_basic__list_domains):
|
||||||
scenario = basic.DesignateBasic(self.context)
|
scenario = basic.DesignateBasic(self.context)
|
||||||
|
|||||||
@@ -69,6 +69,17 @@ class DesignateScenarioTestCase(test.ScenarioTestCase):
|
|||||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||||
"designate.delete_domain")
|
"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(
|
@ddt.data(
|
||||||
{},
|
{},
|
||||||
{"data": "127.0.0.1"})
|
{"data": "127.0.0.1"})
|
||||||
|
|||||||
Reference in New Issue
Block a user