From 66e77221386cae4430ad27cba0290289711c6208 Mon Sep 17 00:00:00 2001 From: Alex Krzos Date: Tue, 28 Jun 2016 18:39:44 -0400 Subject: [PATCH] Add keystone validate token using ceilometer scenario Change-Id: I2d6220f2ac6149e1177d8fc324f4cfd541d41ae3 --- rally-jobs/rally-keystone-api-v2.yaml | 16 +++++++++++++++ .../scenarios/authenticate/authenticate.py | 18 +++++++++++++++++ .../token-validate-ceilometer.json | 20 +++++++++++++++++++ .../token-validate-ceilometer.yaml | 13 ++++++++++++ .../authenticate/test_authenticate.py | 9 +++++++++ 5 files changed, 76 insertions(+) create mode 100644 samples/tasks/scenarios/authenticate/token-validate-ceilometer.json create mode 100644 samples/tasks/scenarios/authenticate/token-validate-ceilometer.yaml diff --git a/rally-jobs/rally-keystone-api-v2.yaml b/rally-jobs/rally-keystone-api-v2.yaml index 3adeb105..ed94e270 100644 --- a/rally-jobs/rally-keystone-api-v2.yaml +++ b/rally-jobs/rally-keystone-api-v2.yaml @@ -705,6 +705,22 @@ failure_rate: max: 0 + Authenticate.validate_ceilometer: + - + args: + repetitions: 2 + runner: + type: "constant" + times: 10 + concurrency: 5 + context: + users: + tenants: 3 + users_per_tenant: 5 + sla: + failure_rate: + max: 0 + Authenticate.validate_glance: - args: diff --git a/rally/plugins/openstack/scenarios/authenticate/authenticate.py b/rally/plugins/openstack/scenarios/authenticate/authenticate.py index 89632b91..65a85b87 100644 --- a/rally/plugins/openstack/scenarios/authenticate/authenticate.py +++ b/rally/plugins/openstack/scenarios/authenticate/authenticate.py @@ -68,6 +68,24 @@ class Authenticate(scenario.OpenStackScenario): for i in range(repetitions): nova_client.flavors.list() + @validation.number("repetitions", minval=1) + @validation.required_openstack(users=True) + @scenario.configure() + def validate_ceilometer(self, repetitions): + """Check Ceilometer Client to ensure validation of token. + + Creation of the client does not ensure validation of the token. + We have to do some minimal operation to make sure token gets validated. + + :param repetitions: number of times to validate + """ + ceilometer_client = self.clients("ceilometer") + with atomic.ActionTimer(self, + "authenticate.validate_ceilometer_%s_times" + % repetitions): + for i in range(repetitions): + ceilometer_client.meters.list() + @validation.number("repetitions", minval=1) @validation.required_openstack(users=True) @scenario.configure() diff --git a/samples/tasks/scenarios/authenticate/token-validate-ceilometer.json b/samples/tasks/scenarios/authenticate/token-validate-ceilometer.json new file mode 100644 index 00000000..d915cc1d --- /dev/null +++ b/samples/tasks/scenarios/authenticate/token-validate-ceilometer.json @@ -0,0 +1,20 @@ +{ + "Authenticate.validate_ceilometer": [ + { + "args": { + "repetitions": 2 + }, + "runner": { + "type": "constant", + "times": 10, + "concurrency": 5 + }, + "context": { + "users": { + "tenants": 3, + "users_per_tenant": 5 + } + } + } + ] +} diff --git a/samples/tasks/scenarios/authenticate/token-validate-ceilometer.yaml b/samples/tasks/scenarios/authenticate/token-validate-ceilometer.yaml new file mode 100644 index 00000000..474150e2 --- /dev/null +++ b/samples/tasks/scenarios/authenticate/token-validate-ceilometer.yaml @@ -0,0 +1,13 @@ +--- + Authenticate.validate_ceilometer: + - + args: + repetitions: 2 + runner: + type: "constant" + times: 10 + concurrency: 5 + context: + users: + tenants: 3 + users_per_tenant: 5 diff --git a/tests/unit/plugins/openstack/scenarios/authenticate/test_authenticate.py b/tests/unit/plugins/openstack/scenarios/authenticate/test_authenticate.py index aa1f6849..5b4256a3 100644 --- a/tests/unit/plugins/openstack/scenarios/authenticate/test_authenticate.py +++ b/tests/unit/plugins/openstack/scenarios/authenticate/test_authenticate.py @@ -56,6 +56,15 @@ class AuthenticateTestCase(test.ScenarioTestCase): self._test_atomic_action_timer(scenario_inst.atomic_actions(), "authenticate.validate_nova_5_times") + def test_validate_ceilometer(self): + scenario_inst = authenticate.Authenticate() + scenario_inst.validate_ceilometer(5) + self.clients("ceilometer").meters.list.assert_has_calls( + [mock.call()] * 5) + self._test_atomic_action_timer( + scenario_inst.atomic_actions(), + "authenticate.validate_ceilometer_5_times") + def test_validate_cinder(self): scenario_inst = authenticate.Authenticate() scenario_inst.validate_cinder(5)