Merge "Avoid race in OSWaitCondition test"
diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py
index 4fdfb8e..f75385f 100644
--- a/heat_tempest_plugin/common/test.py
+++ b/heat_tempest_plugin/common/test.py
@@ -34,6 +34,7 @@
 
 LOG = logging.getLogger(__name__)
 _LOG_FORMAT = "%(levelname)8s [%(name)s] %(message)s"
+_resource_types = None
 
 
 def call_until_true(duration, sleep_for, func, *args, **kwargs):
@@ -86,7 +87,31 @@
     return skipper(test_method)
 
 
-class HeatIntegrationTest(testscenarios.WithScenarios,
+def requires_resource_type(resource_type):
+    '''Decorator for tests requiring a resource type.
+
+    The decorated test will be skipped when the resource type is not available.
+    '''
+    def decorator(test_method):
+        conf = getattr(config.CONF, 'heat_plugin', None)
+        if not conf or conf.auth_url is None:
+            return test_method
+
+        global _resource_types
+        if not _resource_types:
+            manager = clients.ClientManager(conf)
+            obj_rtypes = manager.orchestration_client.resource_types.list()
+            _resource_types = list(t.resource_type for t in obj_rtypes)
+        rtype_available = resource_type and resource_type in _resource_types
+        skipper = testtools.skipUnless(
+            rtype_available,
+            "%s resource type not available, skipping test." % resource_type)
+        return skipper(test_method)
+    return decorator
+
+
+class HeatIntegrationTest(testtools.testcase.WithAttributes,
+                          testscenarios.WithScenarios,
                           testtools.TestCase):
 
     def setUp(self):
diff --git a/heat_tempest_plugin/tests/api/gabbits/environments.yaml b/heat_tempest_plugin/tests/api/gabbits/environments.yaml
index 17ac476..fe1dc04 100644
--- a/heat_tempest_plugin/tests/api/gabbits/environments.yaml
+++ b/heat_tempest_plugin/tests/api/gabbits/environments.yaml
@@ -4,6 +4,7 @@
 
 tests:
 - name: environment with parameter
+  desc: 8281d088-0c80-4071-a13d-333b309be6ca
   POST: /stacks
   request_headers:
     content-type: application/json
@@ -34,15 +35,17 @@
     location: //stacks/$ENVIRON['PREFIX']-envstack/[a-f0-9-]+/
 
 - name: poll for envstack CREATE_COMPLETE
+  desc: 29899c70-9c94-4e24-8988-df76f7eaaa70
   GET: $LOCATION
   redirects: True
   poll:
-    count: 5
+    count: 10
     delay: 1.0
   response_json_paths:
     $.stack.stack_status: CREATE_COMPLETE
 
 - name: get stack output
+  desc: f60dd8df-82d1-4228-8926-54d65ebd12e1
   GET: $LAST_URL/outputs/output_value
   redirects: True
   status: 200
@@ -50,6 +53,7 @@
     $.output.output_value: test
 
 - name: delete envstack
+  desc: 0efde180-cc0e-4f2c-bb18-fa345e8d21ad
   DELETE: /stacks/$ENVIRON['PREFIX']-envstack
   redirects: True
   status: 204
diff --git a/heat_tempest_plugin/tests/api/gabbits/resources.yaml b/heat_tempest_plugin/tests/api/gabbits/resources.yaml
index 41da444..c20333b 100644
--- a/heat_tempest_plugin/tests/api/gabbits/resources.yaml
+++ b/heat_tempest_plugin/tests/api/gabbits/resources.yaml
@@ -4,6 +4,7 @@
 
 tests:
 - name: create stack with resources
+  desc: 947be7b2-503d-41f5-9843-61be50954f13
   POST: /stacks
   request_headers:
     content-type: application/json
@@ -29,15 +30,17 @@
     location: //stacks/$ENVIRON['PREFIX']-rsrcstack/[a-f0-9-]+/
 
 - name: poll for rsrcstack CREATE_COMPLETE
+  desc: e9eac22f-c3e7-450f-a087-08a8655a6e8e
   GET: $LOCATION
   redirects: True
   poll:
-    count: 5
+    count: 10
     delay: 1.0
   response_json_paths:
     $.stack.stack_status: CREATE_COMPLETE
 
 - name: list resources
+  desc: ec53f10d-a89a-4243-8706-629a01ea890f
   GET: $LAST_URL/resources
   request_headers:
     content-type: application/json
@@ -47,6 +50,7 @@
     $.resources[0].resource_status: CREATE_COMPLETE
 
 - name: list filtered resources
+  desc: da07d3d2-9ccc-4fa1-9b1b-9cb3074fe9b9
   GET: $LAST_URL
   request_headers:
     content-type: application/json
@@ -57,6 +61,7 @@
     $.resources: []
 
 - name: show resource
+  desc: 2cbcedc5-0aa7-454e-bf89-a3dd5d379dc1
   GET: $LAST_URL/test
   request_headers:
     content-type: application/json
@@ -65,6 +70,7 @@
     $.resource.attributes.output: test
 
 - name: mark resource unhealthy
+  desc: 6031516b-3a8f-4d1b-8990-81a571b5f956
   PATCH: $LAST_URL
   request_headers:
     content-type: application/json
@@ -74,6 +80,7 @@
   status: 200
 
 - name: show unhealthy resource
+  desc: 9e784490-2e88-49af-8ee7-c4c6aba2be64
   GET: $LAST_URL
   status: 200
   response_json_paths:
@@ -81,10 +88,12 @@
     $.resource.resource_status_reason: 'resource deleted'
 
 - name: signal resource
+  desc: c65a047c-8c7b-4b44-9f5f-bf1069751c5c
   POST: $LAST_URL/signal
   status: 400
 
 - name: delete stack with resources
+  desc: 0edc4fdc-811d-4d27-a0dd-6ec4db2bda6e
   DELETE: /stacks/$ENVIRON['PREFIX']-rsrcstack
   redirects: True
   status: 204
diff --git a/heat_tempest_plugin/tests/api/gabbits/resourcetypes.yaml b/heat_tempest_plugin/tests/api/gabbits/resourcetypes.yaml
index 0730cc8..a259214 100644
--- a/heat_tempest_plugin/tests/api/gabbits/resourcetypes.yaml
+++ b/heat_tempest_plugin/tests/api/gabbits/resourcetypes.yaml
@@ -4,10 +4,12 @@
 
 tests:
 - name: list resource types
+  desc: 5b4db88b-d171-4400-b7a7-a7dc8f597d31
   GET: /resource_types
   status: 200
 
 - name: show resource type
+  desc: cc05d1ef-17f1-430e-bea1-0f6766f7d0b4
   GET: /resource_types/OS::Heat::TestResource
   status: 200
   response_json_paths:
@@ -15,6 +17,7 @@
     $.properties.wait_secs.default: 0
 
 - name: resource type template
+  desc: 5a2164eb-645a-4245-acd7-b222a715fc09
   GET: /resource_types/OS::Heat::TestResource/template
   query_parameters:
     template_type: hot
diff --git a/heat_tempest_plugin/tests/api/gabbits/stacks.yaml b/heat_tempest_plugin/tests/api/gabbits/stacks.yaml
index cb67e71..9d9328e 100644
--- a/heat_tempest_plugin/tests/api/gabbits/stacks.yaml
+++ b/heat_tempest_plugin/tests/api/gabbits/stacks.yaml
@@ -4,12 +4,14 @@
 
 tests:
 - name: stack list
+  desc: 39c0245e-6055-41cf-9f0e-15adfe55ded6
   GET: /stacks
   status: 200
   response_headers:
     content-type: application/json
 
 - name: create empty stack
+  desc: bde1b827-65fb-47ea-909f-82537e6260d3
   POST: /stacks
   request_headers:
     content-type: application/json
@@ -28,25 +30,29 @@
 
 
 - name: poll for empty CREATE_COMPLETE
+  desc: f575e5c4-2aed-4381-9f0d-2dfcb0640c4b
   GET: $LOCATION
   redirects: True
   poll:
-    count: 5
+    count: 10
     delay: 1.0
   response_json_paths:
     $.stack.stack_status: CREATE_COMPLETE
 
 - name: show empty stack
+  desc: 89b233fe-0d55-4959-9289-0b5dabe4e4c9
   GET: $LAST_URL
   redirects: True
   status: 200
 
 - name: delete empty stack
+  desc: 7eca55fe-8300-43b6-a6b8-fb2d99b51911
   DELETE: $LAST_URL
   redirects: True
   status: 204
 
 - name: create stack
+  desc: 56ac2173-97c5-4347-bd32-529a260cfac3
   POST: /stacks
   request_headers:
     content-type: application/json
@@ -74,20 +80,23 @@
     location: //stacks/$ENVIRON['PREFIX']-stack/[a-f0-9-]+/
 
 - name: poll for stack CREATE_COMPLETE
+  desc: 6a0fe2dc-2822-4af3-b606-321ff7ad3de9
   GET: $LOCATION
   redirects: True
   poll:
-    count: 5
+    count: 10
     delay: 1.0
   response_json_paths:
     $.stack.stack_status: CREATE_COMPLETE
 
 - name: show stack
+  desc: 9b268607-0335-4667-a613-bccf81e66f8f
   GET: $LAST_URL
   redirects: True
   status: 200
 
 - name: update stack
+  desc: 6bb1ec02-dd19-4b2c-9a6d-866ce666650f
   PUT: $LAST_URL
   request_headers:
     content-type: application/json
@@ -115,15 +124,17 @@
   status: 202
 
 - name: poll for stack UPDATE_COMPLETE
+  desc: 3e280fb3-02b6-44fb-84dd-e04921d47733
   GET: $LAST_URL
   redirects: True
   poll:
-    count: 5
+    count: 10
     delay: 1.0
   response_json_paths:
     $.stack.stack_status: UPDATE_COMPLETE
 
 - name: patch update stack
+  desc: 927cea42-a35b-4664-b209-ab2cb34e6ef4
   PATCH: $LAST_URL
   request_headers:
     content-type: application/json
@@ -133,16 +144,18 @@
   status: 202
 
 - name: poll for stack patch UPDATE_COMPLETE
+  desc: a1cfd3b4-2536-4c54-94f4-12093f2ccf3b
   GET: $LAST_URL
   redirects: True
   poll:
-    count: 5
+    count: 10
     delay: 1.0
   response_json_paths:
     $.stack.stack_status: UPDATE_COMPLETE
     $.stack.updated_time: /^(?!$HISTORY['poll for stack UPDATE_COMPLETE'].$RESPONSE['$.stack.updated_time'])/
 
 - name: list stack outputs
+  desc: bbd98b50-b75b-44a1-b7e8-0a68fd7c6d33
   GET: $LAST_URL/outputs
   redirects: True
   status: 200
@@ -150,6 +163,7 @@
     $.outputs[0].output_key: output_value
 
 - name: get stack output
+  desc: e761f5d7-70f6-4d95-a11b-e5fa0ecb43d2
   GET: $LAST_URL/output_value
   redirects: True
   status: 200
@@ -157,6 +171,7 @@
     $.output.output_value: new_patched_value
 
 - name: delete stack
+  desc: bcf4c359-0a64-4652-b465-df3f688a9d4d
   DELETE: /stacks/$ENVIRON['PREFIX']-stack
   redirects: True
   status: 204
diff --git a/heat_tempest_plugin/tests/api/gabbits/templates.yaml b/heat_tempest_plugin/tests/api/gabbits/templates.yaml
index 7b67054..0533f4a 100644
--- a/heat_tempest_plugin/tests/api/gabbits/templates.yaml
+++ b/heat_tempest_plugin/tests/api/gabbits/templates.yaml
@@ -4,12 +4,14 @@
 
 tests:
 - name: list template versions
+  desc: cbc28c20-e740-43ef-a01b-b1a39f4a0db3
   GET: /template_versions
   status: 200
   response_json_paths:
     $.template_versions[?(@.version='heat_template_version.2017-02-24')].type: hot
 
 - name: list template functions
+  desc: 721ff23c-8527-480f-a090-1c915b4f8430
   GET: /template_versions/heat_template_version.2016-10-14/functions
   status: 200
   response_json_paths:
@@ -17,6 +19,7 @@
       A function for including a file inline.
 
 - name: template validate
+  desc: f307139b-03d0-4006-92b7-81c86c949727
   POST: /validate
   request_headers:
     content-type: application/json
diff --git a/heat_tempest_plugin/tests/api/test_heat_api.py b/heat_tempest_plugin/tests/api/test_heat_api.py
index bf86839..0a44621 100644
--- a/heat_tempest_plugin/tests/api/test_heat_api.py
+++ b/heat_tempest_plugin/tests/api/test_heat_api.py
@@ -14,13 +14,14 @@
 """A test module to exercise the Heat API with gabbi.  """
 
 import os
+import unittest
 
 from gabbi import driver
 from six.moves.urllib import parse as urlparse
+from tempest import config
 
 from heat_tempest_plugin.common import test
 from heat_tempest_plugin.services import clients
-from tempest import config
 
 TESTS_DIR = 'gabbits'
 
@@ -40,5 +41,26 @@
     os.environ['OS_TOKEN'] = manager.identity_client.auth_token
     os.environ['PREFIX'] = test.rand_name('api')
 
-    return driver.build_tests(test_dir, loader, host=host,
-                              url=endpoint, test_loader_name=__name__)
+    def register_test_case_id(test_case):
+        tempest_id = test_case.test_data.get('desc')
+        test_name = test_case.id()
+        if not tempest_id:
+            raise AssertionError(
+                "No Tempest ID registered for API test %s" % test_name)
+
+        def test_id():
+            return test_name + '[id-%s]' % tempest_id
+
+        test_case.id = test_id
+
+    def register_test_suite_ids(test_suite):
+        for test_case in test_suite:
+            if isinstance(test_case, unittest.TestSuite):
+                register_test_suite_ids(test_case)
+            else:
+                register_test_case_id(test_case)
+
+    api_tests = driver.build_tests(test_dir, loader, host=host,
+                                   url=endpoint, test_loader_name=__name__)
+    register_test_suite_ids(api_tests)
+    return api_tests
diff --git a/heat_tempest_plugin/tests/functional/test_create_update_neutron_trunk.py b/heat_tempest_plugin/tests/functional/test_create_update_neutron_trunk.py
index ff5bcaf..bdcb58e 100644
--- a/heat_tempest_plugin/tests/functional/test_create_update_neutron_trunk.py
+++ b/heat_tempest_plugin/tests/functional/test_create_update_neutron_trunk.py
@@ -17,6 +17,7 @@
 
 from tempest.lib import decorators
 
+from heat_tempest_plugin.common import test
 from heat_tempest_plugin.tests.functional import functional_base
 
 
@@ -72,6 +73,7 @@
 '''
 
 
+@test.requires_resource_type('OS::Neutron::Trunk')
 class UpdateTrunkTest(functional_base.FunctionalTestsBase):
 
     @staticmethod
diff --git a/heat_tempest_plugin/tests/scenario/test_server_signal.py b/heat_tempest_plugin/tests/scenario/test_server_signal.py
index a43c74a..1823087 100644
--- a/heat_tempest_plugin/tests/scenario/test_server_signal.py
+++ b/heat_tempest_plugin/tests/scenario/test_server_signal.py
@@ -29,6 +29,7 @@
             'key_name': self.keypair_name,
             'flavor': flavor,
             'image': image,
+            'public_net': self.conf.floating_network_name,
             'timeout': self.conf.build_timeout,
             'user_data_format': user_data_format
         }
diff --git a/requirements.txt b/requirements.txt
index 34fa1fd..d5dbc36 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2 # MIT
-keystoneauth1>=3.3.0 # Apache-2.0
+keystoneauth1>=3.4.0 # Apache-2.0
 oslo.config>=5.1.0 # Apache-2.0
 oslo.log>=3.36.0 # Apache-2.0
 oslo.messaging>=5.29.0 # Apache-2.0
@@ -11,7 +11,7 @@
 python-cinderclient>=3.3.0 # Apache-2.0
 gnocchiclient>=3.3.1 # Apache-2.0
 python-heatclient>=1.10.0 # Apache-2.0
-python-neutronclient>=6.3.0 # Apache-2.0
+python-neutronclient>=6.7.0 # Apache-2.0
 python-novaclient>=9.1.0 # Apache-2.0
 python-swiftclient>=3.2.0 # Apache-2.0
 python-zaqarclient>=1.0.0 # Apache-2.0
diff --git a/test-requirements.txt b/test-requirements.txt
index 9f37a05..90882be 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,5 +4,5 @@
 
 # Hacking already pins down pep8, pyflakes and flake8
 hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
-openstackdocstheme>=1.17.0 # Apache-2.0
+openstackdocstheme>=1.18.1 # Apache-2.0
 sphinx!=1.6.6,>=1.6.2 # BSD