diff --git a/rally-jobs/rally-keystone-api-v2.yaml b/rally-jobs/rally-keystone-api-v2.yaml index 616ac047..b8da813e 100644 --- a/rally-jobs/rally-keystone-api-v2.yaml +++ b/rally-jobs/rally-keystone-api-v2.yaml @@ -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: diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index d160b790..c5895b7e 100644 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -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: diff --git a/rally/plugins/openstack/scenarios/keystone/basic.py b/rally/plugins/openstack/scenarios/keystone/basic.py index a2f0bdb9..794a92ef 100644 --- a/rally/plugins/openstack/scenarios/keystone/basic.py +++ b/rally/plugins/openstack/scenarios/keystone/basic.py @@ -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) diff --git a/samples/tasks/scenarios/keystone/create-and-get-role.json b/samples/tasks/scenarios/keystone/create-and-get-role.json new file mode 100644 index 00000000..e2c7b3a5 --- /dev/null +++ b/samples/tasks/scenarios/keystone/create-and-get-role.json @@ -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 + } + } + } + ] +} diff --git a/samples/tasks/scenarios/keystone/create-and-get-role.yaml b/samples/tasks/scenarios/keystone/create-and-get-role.yaml new file mode 100644 index 00000000..88cd1226 --- /dev/null +++ b/samples/tasks/scenarios/keystone/create-and-get-role.yaml @@ -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 diff --git a/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py b/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py index fc6656f8..87c72e10 100755 --- a/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py +++ b/tests/unit/plugins/openstack/scenarios/keystone/test_basic.py @@ -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)