From 3fc60c760bbf69a03fa84772bf7eae4be082783b Mon Sep 17 00:00:00 2001 From: Illia Khudoshyn Date: Fri, 29 Jan 2016 16:07:58 +0000 Subject: [PATCH] Fix gates against Keystone V3 Fix 'rally verify' against Keystone v3 Support keystone V3 in tests.ci.osresources Disable Keystone and Ceilometer related scenarios Change-Id: If352298e9ec6ddc0cc0a9e14f14b7218ed6d1707 Co-Authored-By: Alexander Maretskiy --- rally-jobs/rally.yaml | 844 ++++++++++++------------- rally/verification/tempest/config.py | 16 +- tests/ci/osresources.py | 4 +- tests/unit/verification/test_config.py | 21 +- 4 files changed, 457 insertions(+), 428 deletions(-) diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index 3adeb10583..5f09e6cd21 100644 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -1,391 +1,391 @@ {%- set cirros_image_url = "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img" %} --- - KeystoneBasic.create_user: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_user: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_delete_user: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_delete_user: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_user_set_enabled_and_delete: - - - args: - enabled: true - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 - - - args: - enabled: false - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_user_set_enabled_and_delete: + #- + #args: + #enabled: true + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 + #- + #args: + #enabled: false + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_list_tenants: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_list_tenants: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.get_entities: - - - runner: - type: "constant" - times: 20 - concurrency: 10 - sla: - failure_rate: - max: 0 - - - args: - service_name: null - runner: - type: "constant" - times: 20 - concurrency: 10 - sla: - failure_rate: - max: 0 - - - args: - service_name: "nova" - runner: - type: "constant" - times: 20 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.get_entities: + #- + #runner: + #type: "constant" + #times: 20 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 + #- + #args: + #service_name: null + #runner: + #type: "constant" + #times: 20 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 + #- + #args: + #service_name: "nova" + #runner: + #type: "constant" + #times: 20 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.add_and_remove_user_role: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - context: - users: - tenants: 1 - users_per_tenant: 1 - sla: - failure_rate: - max: 0 + #KeystoneBasic.add_and_remove_user_role: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #context: + #users: + #tenants: 1 + #users_per_tenant: 1 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_delete_role: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_delete_role: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_add_and_list_user_roles: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - context: - users: - tenants: 1 - users_per_tenant: 1 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_add_and_list_user_roles: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #context: + #users: + #tenants: 1 + #users_per_tenant: 1 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_list_users: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_list_users: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_tenant: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_tenant: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_tenant_with_users: - - - args: - users_per_tenant: 10 - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 3 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_tenant_with_users: + #- + #args: + #users_per_tenant: 10 + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 3 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_user_update_password: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 5 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_user_update_password: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_update_and_delete_tenant: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 5 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_update_and_delete_tenant: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_delete_user: - - - args: {} - runner: - type: "constant" - times: 10 - concurrency: 10 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_delete_user: + #- + #args: {} + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_delete_service: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_delete_service: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_list_services: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_list_services: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_list_ec2credentials: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_list_ec2credentials: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - KeystoneBasic.create_and_delete_ec2credential: - - - runner: - type: "constant" - times: 10 - concurrency: 5 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #KeystoneBasic.create_and_delete_ec2credential: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 5 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - CeilometerEvents.create_user_and_get_event: - - - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #CeilometerEvents.create_user_and_get_event: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - CeilometerEvents.create_user_and_list_event_types: - - - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #CeilometerEvents.create_user_and_list_event_types: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - CeilometerEvents.create_user_and_list_events: - - - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #CeilometerEvents.create_user_and_list_events: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - CeilometerTraits.create_user_and_list_trait_descriptions: - - - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #CeilometerTraits.create_user_and_list_trait_descriptions: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - CeilometerTraits.create_user_and_list_traits: - - - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 + #CeilometerTraits.create_user_and_list_traits: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #sla: + #failure_rate: + #max: 0 - CeilometerMeters.list_meters: - - - runner: - type: constant - times: 10 - concurrency: 2 - context: - users: - tenants: 1 - users_per_tenant: 1 - ceilometer: - counter_name: "benchmark_meter" - counter_type: "gauge" - counter_unit: "%" - counter_volume: 100 - resources_per_tenant: 1 - samples_per_resource: 1 - timestamp_interval: 1 - sla: - failure_rate: - max: 0 + #CeilometerMeters.list_meters: + #- + #runner: + #type: constant + #times: 10 + #concurrency: 2 + #context: + #users: + #tenants: 1 + #users_per_tenant: 1 + #ceilometer: + #counter_name: "benchmark_meter" + #counter_type: "gauge" + #counter_unit: "%" + #counter_volume: 100 + #resources_per_tenant: 1 + #samples_per_resource: 1 + #timestamp_interval: 1 + #sla: + #failure_rate: + #max: 0 - CeilometerResource.list_resources: - - - runner: - type: constant - times: 10 - concurrency: 2 - context: - users: - tenants: 1 - users_per_tenant: 1 - ceilometer: - counter_name: "benchmark_meter" - counter_type: "gauge" - counter_unit: "%" - counter_volume: 100 - resources_per_tenant: 1 - samples_per_resource: 1 - timestamp_interval: 1 - sla: - failure_rate: - max: 0 + #CeilometerResource.list_resources: + #- + #runner: + #type: constant + #times: 10 + #concurrency: 2 + #context: + #users: + #tenants: 1 + #users_per_tenant: 1 + #ceilometer: + #counter_name: "benchmark_meter" + #counter_type: "gauge" + #counter_unit: "%" + #counter_volume: 100 + #resources_per_tenant: 1 + #samples_per_resource: 1 + #timestamp_interval: 1 + #sla: + #failure_rate: + #max: 0 - CeilometerSamples.list_samples: - - - runner: - type: "constant" - times: 10 - concurrency: 10 - context: - users: - tenants: 1 - users_per_tenant: 1 - ceilometer: - counter_name: "cpu_util" - counter_type: "gauge" - counter_unit: "instance" - counter_volume: 1.0 - resources_per_tenant: 3 - samples_per_resource: 10 - timestamp_interval: 60 - metadata_list: - - status: "active" - name: "fake_resource" - deleted: "False" - created_at: "2015-09-04T12:34:19.000000" - - status: "not_active" - name: "fake_resource_1" - deleted: "False" - created_at: "2015-09-10T06:55:12.000000" - batch_size: 5 - sla: - failure_rate: - max: 0 + #CeilometerSamples.list_samples: + #- + #runner: + #type: "constant" + #times: 10 + #concurrency: 10 + #context: + #users: + #tenants: 1 + #users_per_tenant: 1 + #ceilometer: + #counter_name: "cpu_util" + #counter_type: "gauge" + #counter_unit: "instance" + #counter_volume: 1.0 + #resources_per_tenant: 3 + #samples_per_resource: 10 + #timestamp_interval: 60 + #metadata_list: + #- status: "active" + #name: "fake_resource" + #deleted: "False" + #created_at: "2015-09-04T12:34:19.000000" + #- status: "not_active" + #name: "fake_resource_1" + #deleted: "False" + #created_at: "2015-09-10T06:55:12.000000" + #batch_size: 5 + #sla: + #failure_rate: + #max: 0 Dummy.dummy: - @@ -628,68 +628,68 @@ failure_rate: max: 0 - CeilometerStats.get_stats: - - - runner: - type: constant - times: 10 - concurrency: 2 - context: - users: - tenants: 2 - users_per_tenant: 2 - ceilometer: - counter_name: "benchmark_meter" - counter_type: "gauge" - counter_unit: "%" - counter_volume: 100 - resources_per_tenant: 100 - samples_per_resource: 100 - timestamp_interval: 10 - metadata_list: - - - status: "active" - name: "rally benchmark on" - deleted: "false" - - - status: "terminated" - name: "rally benchmark off" - deleted: "true" - args: - meter_name: "benchmark_meter" - filter_by_user_id: true - filter_by_project_id: true - filter_by_resource_id: true - metadata_query: - status: "terminated" - period: 300 - groupby: "resource_id" - sla: - failure_rate: - max: 0 + #CeilometerStats.get_stats: + #- + #runner: + #type: constant + #times: 10 + #concurrency: 2 + #context: + #users: + #tenants: 2 + #users_per_tenant: 2 + #ceilometer: + #counter_name: "benchmark_meter" + #counter_type: "gauge" + #counter_unit: "%" + #counter_volume: 100 + #resources_per_tenant: 100 + #samples_per_resource: 100 + #timestamp_interval: 10 + #metadata_list: + #- + #status: "active" + #name: "rally benchmark on" + #deleted: "false" + #- + #status: "terminated" + #name: "rally benchmark off" + #deleted: "true" + #args: + #meter_name: "benchmark_meter" + #filter_by_user_id: true + #filter_by_project_id: true + #filter_by_resource_id: true + #metadata_query: + #status: "terminated" + #period: 300 + #groupby: "resource_id" + #sla: + #failure_rate: + #max: 0 - CeilometerQueries.create_and_query_samples: - - - args: - filter: {"=": {"counter_unit": "instance"}} - orderby: !!null - limit: 10 - counter_name: "cpu_util" - counter_type: "gauge" - counter_unit: "instance" - counter_volume: "1.0" - resource_id: "resource_id" - runner: - type: "constant" - times: 20 - concurrency: 10 - context: - users: - tenants: 1 - users_per_tenant: 1 - sla: - failure_rate: - max: 0 + #CeilometerQueries.create_and_query_samples: + #- + #args: + #filter: {"=": {"counter_unit": "instance"}} + #orderby: !!null + #limit: 10 + #counter_name: "cpu_util" + #counter_type: "gauge" + #counter_unit: "instance" + #counter_volume: "1.0" + #resource_id: "resource_id" + #runner: + #type: "constant" + #times: 20 + #concurrency: 10 + #context: + #users: + #tenants: 1 + #users_per_tenant: 1 + #sla: + #failure_rate: + #max: 0 Authenticate.keystone: - diff --git a/rally/verification/tempest/config.py b/rally/verification/tempest/config.py index aae58d626f..934595e23f 100644 --- a/rally/verification/tempest/config.py +++ b/rally/verification/tempest/config.py @@ -131,10 +131,18 @@ class TempestConfig(utils.RandomNameGeneratorMixin): "HTTP error code %d.") % response.status_code raise exceptions.TempestConfigCreationFailure(msg) - def _get_service_url(self, service_type): - for service in self.keystone.auth_ref["serviceCatalog"]: - if self.clients.services().get(service["type"]) == service_type: - return service["endpoints"][0]["publicURL"] + def _get_service_url(self, service_name): + s_type = self._get_service_type_by_service_name(service_name) + if hasattr(self.keystone, "service_catalog"): + available_endpoints = self.keystone.service_catalog.get_endpoints() + service_endpoints = available_endpoints.get(s_type, []) + for endpoint in service_endpoints: + if endpoint["interface"] == "public": + return endpoint["url"] + else: + for service in self.keystone.auth_ref["serviceCatalog"]: + if service["type"] == s_type: + return service["endpoints"][0]["publicURL"] def _get_service_type_by_service_name(self, service_name): for s_type, s_name in six.iteritems(self.clients.services()): diff --git a/tests/ci/osresources.py b/tests/ci/osresources.py index 2c1903d632..4775b70103 100755 --- a/tests/ci/osresources.py +++ b/tests/ci/osresources.py @@ -78,7 +78,9 @@ class Keystone(ResourceManager): return self.client.users.list() def list_tenants(self): - return self.client.tenants.list() + if hasattr(self.client, "projects"): + return self.client.projects.list() # V3 + return self.client.tenants.list() # V2 def list_roles(self): return self.client.roles.list() diff --git a/tests/unit/verification/test_config.py b/tests/unit/verification/test_config.py index 1ddc65321a..4c5049733b 100644 --- a/tests/unit/verification/test_config.py +++ b/tests/unit/verification/test_config.py @@ -82,7 +82,8 @@ class TempestConfigTestCase(test.TestCase): self.assertRaises(exceptions.TempestConfigCreationFailure, self.tempest_conf._download_cirros_image) - def test__get_service_url(self): + def test__get_service_url_keystone_v2(self): + self.tempest_conf.keystone = mock.MagicMock(spec=["auth_ref"]) self.tempest_conf.keystone.auth_ref = { "serviceCatalog": [ { @@ -97,6 +98,24 @@ class TempestConfigTestCase(test.TestCase): self.assertEqual( self.tempest_conf._get_service_url("test_service"), "test_url") + def test__get_service_url_keystone_v3(self): + + mock_catalog = mock.MagicMock() + mock_catalog.get_endpoints.return_value = { + "test_service_type": [ + { + "interface": "public", + "url": "test_url" + } + ] + } + + self.tempest_conf.keystone.service_catalog = mock_catalog + self.tempest_conf.clients.services.return_value = { + "test_service_type": "test_service"} + self.assertEqual( + self.tempest_conf._get_service_url("test_service"), "test_url") + @mock.patch("rally.verification.tempest.config." "TempestConfig._get_service_url", return_value="test_url") def test__configure_boto(self, mock__get_service_url):