Merge "Fix api_versions@openstack context plugin"

This commit is contained in:
Jenkins 2017-09-27 06:26:21 +00:00 committed by Gerrit Code Review
commit 812fb9b7b2
3 changed files with 14 additions and 5 deletions
rally-jobs
rally/plugins/openstack/context
tests/unit/plugins/openstack/context

View File

@ -34,6 +34,10 @@
users:
tenants: 2
users_per_tenant: 2
api_versions:
cinder:
version: 2
service_name: cinderv2
-
description: "Create a volume from the specified image."
scenario:

View File

@ -257,9 +257,14 @@ class OpenStackAPIVersions(context.Context):
_("There is no '%s' service in your environment") %
conf["service_name"])
self.context["config"]["api_versions"][client_name][
# TODO(boris-42): Use separate key ["openstack"]["versions"]
self.context["config"]["api_versions@openstack"][client_name][
"service_type"] = services_from_admin[conf["service_name"]]
# NOTE(boris-42): Required to be backward compatible
self.context["config"]["api_versions"] = (
self.context["config"]["api_versions@openstack"])
def cleanup(self):
# nothing to do here
pass

View File

@ -52,7 +52,7 @@ class OpenStackServicesTestCase(test.TestCase):
def test_setup_with_wrong_service_name(self):
context_obj = {
"config": {api_versions.OpenStackAPIVersions.get_name(): {
"config": {api_versions.OpenStackAPIVersions.get_fullname(): {
"nova": {"service_name": "service_name"}}},
"admin": {"credential": mock.MagicMock()},
"users": [{"credential": mock.MagicMock()}]}
@ -63,7 +63,7 @@ class OpenStackServicesTestCase(test.TestCase):
def test_setup_with_wrong_service_name_and_without_admin(self):
context_obj = {
"config": {api_versions.OpenStackAPIVersions.get_name(): {
"config": {api_versions.OpenStackAPIVersions.get_fullname(): {
"nova": {"service_name": "service_name"}}},
"users": [{"credential": mock.MagicMock()}]}
ctx = api_versions.OpenStackAPIVersions(context_obj)
@ -73,7 +73,7 @@ class OpenStackServicesTestCase(test.TestCase):
def test_setup_with_wrong_service_type(self):
context_obj = {
"config": {api_versions.OpenStackAPIVersions.get_name(): {
"config": {api_versions.OpenStackAPIVersions.get_fullname(): {
"nova": {"service_type": "service_type"}}},
"users": [{"credential": mock.MagicMock()}]}
ctx = api_versions.OpenStackAPIVersions(context_obj)
@ -83,7 +83,7 @@ class OpenStackServicesTestCase(test.TestCase):
def test_setup_with_service_name(self):
self.mock_kc.services.list.return_value = [
utils.Struct(type="computev21", name="NovaV21")]
name = api_versions.OpenStackAPIVersions.get_name()
name = api_versions.OpenStackAPIVersions.get_fullname()
context = {
"config": {name: {"nova": {"service_name": "NovaV21"}}},
"admin": {"credential": mock.MagicMock()},