Merge "functional: skip test_auth_via_keystone_vX if X is not available"
This commit is contained in:
commit
f987a6893a
@ -16,9 +16,11 @@ import uuid
|
||||
|
||||
from cinderclient.v2 import client as cinderclient
|
||||
import fixtures
|
||||
from keystoneauth1.exceptions import discovery as discovery_exc
|
||||
from keystoneauth1 import identity
|
||||
from keystoneauth1 import session as ksession
|
||||
from keystoneclient import client as keystoneclient
|
||||
from keystoneclient import discover as keystone_discover
|
||||
import os_client_config
|
||||
import six
|
||||
import tempest.lib.cli.base
|
||||
@ -33,6 +35,18 @@ BOOT_IS_COMPLETE = ("login as 'cirros' user. default password: "
|
||||
"'cubswin:)'. use 'sudo' for root.")
|
||||
|
||||
|
||||
def is_keystone_version_available(session, version):
|
||||
"""Given a (major, minor) pair, check if the API version is enabled."""
|
||||
|
||||
d = keystone_discover.Discover(session)
|
||||
try:
|
||||
d.create_client(version)
|
||||
except (discovery_exc.DiscoveryFailure, discovery_exc.VersionNotAvailable):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
# The following are simple filter functions that filter our available
|
||||
# image / flavor list so that they can be used in standard testing.
|
||||
def pick_flavor(flavors):
|
||||
|
@ -36,7 +36,17 @@ class TestAuthentication(base.ClientTestBase):
|
||||
"nova", action, flags, cli_dir=self.cli_clients.cli_dir)
|
||||
|
||||
def test_auth_via_keystone_v2(self):
|
||||
session = self.keystone.session
|
||||
version = (2, 0)
|
||||
if not base.is_keystone_version_available(session, version):
|
||||
self.skip("Identity API version 2.0 is not available.")
|
||||
|
||||
self.nova("list", identity_api_version="2.0")
|
||||
|
||||
def test_auth_via_keystone_v3(self):
|
||||
session = self.keystone.session
|
||||
version = (3, 0)
|
||||
if not base.is_keystone_version_available(session, version):
|
||||
self.skip("Identity API version 3.0 is not available.")
|
||||
|
||||
self.nova("list", identity_api_version="3")
|
||||
|
Loading…
x
Reference in New Issue
Block a user