Fix auth issue in verification

Tempest config generator had a wrong logic for the case when there is
only one keystone version is available.

This patch uses the same urls(discovered from the catalog) for keystone
as it is done for the case when we have both keystone v2 and v3.

Also, it reverts I1c28dbcdc69b0510a2a9de67e6af7160123932fd

Change-Id: I44dbcb9650e22f8867709f3d0fb5f39ef2ce477a
This commit is contained in:
Andrey Kurilin 2017-09-26 12:35:27 +03:00
parent 360f6a38df
commit 956e6586d8
4 changed files with 20 additions and 11 deletions

View File

@ -23,6 +23,8 @@ attach_encrypted_volume = False
[identity]
[identity-feature-enabled]
[image-feature-enabled]
deactivate_image = True

View File

@ -19,7 +19,6 @@ import os
from oslo_config import cfg
import six
from six.moves import configparser
from six.moves.urllib import parse
from rally.common import logging
from rally import exceptions
@ -95,17 +94,19 @@ class TempestConfigfileManager(object):
uri_v3 = versions[3]
target_version = 3
elif set(versions.keys()) == {2} or set(versions.keys()) == {3}:
# only one version is available while discovering, let's just
# guess the second auth_url (it should not be used)
# only one version is available while discovering
# get the most recent version
target_version = sorted(versions.keys())[-1]
if target_version == 2:
uri = self.credential.auth_url
uri_v3 = parse.urljoin(uri, "/v3")
uri = versions[2]
uri_v3 = os.path.join(cropped_auth_url, "v3")
else:
uri_v3 = self.credential.auth_url
uri = parse.urljoin(uri_v3, "/v2.0")
# keystone v2 is disabled. let's do it explicitly
self.conf.set("identity-feature-enabled", "api_v2",
"False")
uri_v3 = versions[3]
uri = os.path.join(cropped_auth_url, "v2.0")
else:
# Does Keystone released new version of API ?!
LOG.debug("Discovered keystone versions: %s", versions)

View File

@ -325,7 +325,7 @@ class RunVerification(Step):
def run(self):
super(RunVerification, self).run()
if False and "Success: 0" in self.result["output"]:
if "Success: 0" in self.result["output"]:
self.result["status"] = Status.FAILURE

View File

@ -105,18 +105,20 @@ class TempestConfigfileManagerTestCase(test.TestCase):
# case #5: only one version is discoverable;
{"auth_url": "http://example.com",
"data": [{"version": (2, 0), "url": "foo2.com"}],
"ex_uri": "http://example.com", "ex_auth_version": "v2",
"ex_uri": "foo2.com", "ex_auth_version": "v2",
"ex_uri_v3": "http://example.com/v3"},
# case #6: the same case, but keystone v3 is discoverable
{"auth_url": "http://example.com",
"data": [{"version": (3, 0), "url": "foo3.com"}],
"ex_uri": "http://example.com/v2.0", "ex_auth_version": "v3",
"ex_uri_v3": "http://example.com"}
"ex_uri_v3": "foo3.com",
"ex_v2_off": True}
)
@ddt.unpack
def test__configure_identity(self, auth_url, data, ex_uri,
ex_uri_v3, ex_auth_version):
ex_uri_v3, ex_auth_version, ex_v2_off=False):
self.tempest.conf.add_section("identity")
self.tempest.conf.add_section("identity-feature-enabled")
self.tempest.credential.auth_url = auth_url
process_url = osclients.Keystone(
self.tempest.credential, 0, 0)._remove_url_version
@ -141,6 +143,10 @@ class TempestConfigfileManagerTestCase(test.TestCase):
CRED["https_insecure"]),
"ca_certificates_file": CRED["https_cacert"]}
self.assertEqual(expected, dict(self.tempest.conf.items("identity")))
if ex_v2_off:
self.assertEqual(
"False",
self.tempest.conf.get("identity-feature-enabled", "api_v2"))
def test__configure_network_if_neutron(self):
self.tempest.available_services = ["neutron"]