From 983cccb6628bcd8dc310a867e35709e0b410c9d6 Mon Sep 17 00:00:00 2001
From: Dean Troyer <dtroyer@gmail.com>
Date: Tue, 2 May 2017 10:29:59 -0500
Subject: [PATCH] Functional tests: Identity v2 and DevStack

DevStack master (as of 01May2017) no longer sets up an Identity v2
admin endpoint, so we need to skip those tests going forward and cover
them via a specific leagacy job.  This does the detect-and-skip.

Change-Id: Ib9ab32b6bc84ec7d13508094ad6f83995d8d7bc1
---
 .../tests/functional/identity/v2/common.py    | 23 ++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/openstackclient/tests/functional/identity/v2/common.py b/openstackclient/tests/functional/identity/v2/common.py
index 4f3e180134..69ef728b15 100644
--- a/openstackclient/tests/functional/identity/v2/common.py
+++ b/openstackclient/tests/functional/identity/v2/common.py
@@ -13,6 +13,7 @@
 import os
 
 from tempest.lib.common.utils import data_utils
+from tempest.lib import exceptions as tempest_exceptions
 
 from openstackclient.tests.functional import base
 
@@ -49,12 +50,22 @@ class IdentityTests(base.TestCase):
         # create dummy project
         cls.project_name = data_utils.rand_name('TestProject')
         cls.project_description = data_utils.rand_name('description')
-        cls.openstack(
-            'project create '
-            '--description %(description)s '
-            '--enable '
-            '%(name)s' % {'description': cls.project_description,
-                          'name': cls.project_name})
+        try:
+            cls.openstack(
+                'project create '
+                '--description %(description)s '
+                '--enable '
+                '%(name)s' % {
+                    'description': cls.project_description,
+                    'name': cls.project_name,
+                }
+            )
+        except tempest_exceptions.CommandFailed:
+            # Good chance this is due to Identity v2 admin not being enabled
+            # TODO(dtroyer): Actually determine if Identity v2 admin is
+            #                enabled in the target cloud.  Tuens out OSC
+            #                doesn't make this easy as it should (yet).
+            raise cls.skipException('No Identity v2 admin endpoint?')
 
     @classmethod
     def tearDownClass(cls):