Allow convergence-specific Tempest tests

Add a "convergence_engine_enabled" configuration option to the functional
tests' Tempest plugin. The option is enabled by default, but can be
disabled by setting the DISABLE_CONVERGENCE environment variable to "true"
when running prepare_test_env.sh, so that if convergence is disabled in
devstack it will also be disabled in Tempest.

This will allow us to write functional tests for convergence-specific (or
non-convergence-specific) behaviours.

Change-Id: If3a37de75467d50af10582215e16611e59a4ad06
diff --git a/common/test.py b/common/test.py
index d43dece..a6aab7e 100644
--- a/common/test.py
+++ b/common/test.py
@@ -68,6 +68,17 @@
         return randbits
 
 
+def requires_convergence(test_method):
+    '''Decorator for convergence-only tests.
+
+    The decorated test will be skipped when convergence is disabled.
+    '''
+    convergence_enabled = config.CONF.heat_plugin.convergence_engine_enabled
+    skipper = testtools.skipUnless(convergence_enabled,
+                                   "Convergence-only tests are disabled")
+    return skipper(test_method)
+
+
 class HeatIntegrationTest(testscenarios.WithScenarios,
                           testtools.TestCase):