Merge "Add keystone.CreateAndGetRole scenario"

This commit is contained in:
Jenkins 2016-11-07 12:15:52 +00:00 committed by Gerrit Code Review
commit 78ca50bd60
6 changed files with 91 additions and 0 deletions

View File

@ -120,6 +120,21 @@
failure_rate:
max: 0
KeystoneBasic.create_and_get_role:
-
args: {}
runner:
type: "constant"
times: 10
concurrency: 5
context:
users:
tenants: 2
users_per_tenant: 2
sla:
failure_rate:
max: 0
KeystoneBasic.create_add_and_list_user_roles:
-
runner:

View File

@ -109,6 +109,21 @@
failure_rate:
max: 0
KeystoneBasic.create_and_get_role:
-
args: {}
runner:
type: "constant"
times: 10
concurrency: 5
context:
users:
tenants: 2
users_per_tenant: 2
sla:
failure_rate:
max: 0
#KeystoneBasic.create_add_and_list_user_roles:
#-
#runner:

View File

@ -332,3 +332,17 @@ class CreateAndDeleteEc2Credential(kutils.KeystoneScenario):
creds = self._create_ec2credentials(self.context["user"]["id"],
self.context["tenant"]["id"])
self._delete_ec2credential(self.context["user"]["id"], creds.access)
@validation.required_openstack(admin=True)
@scenario.configure(context={"admin_cleanup": ["keystone"]},
name="KeystoneBasic.create_and_get_role")
class CreateAndGetRole(kutils.KeystoneScenario):
def run(self, **kwargs):
"""Create a user role and get it detailed information.
:param kwargs: Optional additional arguments for roles creation
"""
role = self._role_create(**kwargs)
self._get_role(role.id)

View File

@ -0,0 +1,23 @@
{
"KeystoneBasic.create_and_get_role": [
{
"args": {},
"runner": {
"type": "constant",
"times": 10,
"concurrency": 2
},
"context": {
"users": {
"tenants": 3,
"users_per_tenant": 2
}
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]
}

View File

@ -0,0 +1,15 @@
---
KeystoneBasic.create_and_get_role:
-
args: {}
runner:
type: "constant"
times: 10
concurrency: 2
context:
users:
tenants: 3
users_per_tenant: 2
sla:
failure_rate:
max: 0

View File

@ -148,6 +148,15 @@ class KeystoneBasicTestCase(test.ScenarioTestCase):
scenario._role_create.assert_called_once_with()
scenario._role_delete.assert_called_once_with(fake_role.id)
def test_create_and_get_role(self):
scenario = basic.CreateAndGetRole(self.context)
fake_role = mock.MagicMock()
scenario._role_create = mock.MagicMock(return_value=fake_role)
scenario._get_role = mock.MagicMock()
scenario.run()
scenario._role_create.assert_called_once_with()
scenario._get_role.assert_called_once_with(fake_role.id)
def test_create_and_list_user_roles(self):
context = self._get_context()
scenario = basic.CreateAddAndListUserRoles(context)