Separate prometheus related tests

We have an issue, that tempest doesn't distinguish between
branches. New features aren't available on old branches and
so we can't execute testing, which involves sg-core or prometheus
on old branches. Separating sg-core and prometheus related tests
allows us to use tempest regex to execute those tests only on
branches, which have the required features.

This also fills in service_available requirements, to make it
clear which tests are runable on prometheus based storage
and which are runable on gnocchi based storage.

Change-Id: Ic5bea08295d8c85303c676706415e093625ee16f
diff --git a/.zuul.yaml b/.zuul.yaml
index 211fc57..fdeb80f 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -93,6 +93,13 @@
         USE_PYTHON3: True
         TEMPEST_PLUGINS: '"/opt/stack/telemetry-tempest-plugin /opt/stack/heat-tempest-plugin"'
         GNOCCHI_ARCHIVE_POLICY_TEMPEST: "ceilometer-high-rate"
+        # NOTE(jwysogla): We can define both of the variables. In versions, where
+        # the ceilometer devstack plugin doesn't support the CEILOMETER_BACKENDS,
+        # it'll just ignore it and use the CEILOMETER_BACKEND. In versions, where
+        # CEILOMETER_BACKENDS is supported, the ceilometer devstack plugin will
+        # just try to merge the variables, so the final contents in this casse will
+        # be "gnocchi,sg-core"
+        CEILOMETER_BACKEND: "gnocchi"
         CEILOMETER_BACKENDS: "gnocchi,sg-core"
         CEILOMETER_PIPELINE_INTERVAL: 15
         CEILOMETER_ALARM_THRESHOLD: 6000000000
diff --git a/telemetry_tempest_plugin/aodh/api/base.py b/telemetry_tempest_plugin/aodh/api/base.py
index 816f204..7298170 100644
--- a/telemetry_tempest_plugin/aodh/api/base.py
+++ b/telemetry_tempest_plugin/aodh/api/base.py
@@ -31,6 +31,8 @@
         super(BaseAlarmingTest, cls).skip_checks()
         if not CONF.service_available.aodh:
             raise cls.skipException("Aodh support is required")
+        if not CONF.service_available.gnocchi:
+            raise cls.skipException("Gnocchi support is required")
 
     @classmethod
     def setup_clients(cls):
diff --git a/telemetry_tempest_plugin/config.py b/telemetry_tempest_plugin/config.py
index ef43cf7..be3f6d4 100644
--- a/telemetry_tempest_plugin/config.py
+++ b/telemetry_tempest_plugin/config.py
@@ -30,6 +30,10 @@
                   cfg.BoolOpt('gnocchi',
                               default=True,
                               help="Whether or not Gnocchi is expected to be"
+                                   "available"),
+                  cfg.BoolOpt('sg_core',
+                              default=True,
+                              help="Whether or not sg-core is expected to be"
                                    "available")]
 
 telemetry_group = cfg.OptGroup(name='telemetry',
diff --git a/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/ceilometer-sg-core-integration.yaml b/telemetry_tempest_plugin/scenario/telemetry_integration_prometheus_gabbits/ceilometer-sg-core-integration.yaml
similarity index 100%
rename from telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/ceilometer-sg-core-integration.yaml
rename to telemetry_tempest_plugin/scenario/telemetry_integration_prometheus_gabbits/ceilometer-sg-core-integration.yaml
diff --git a/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py b/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py
new file mode 100644
index 0000000..c379470
--- /dev/null
+++ b/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py
@@ -0,0 +1,44 @@
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+import os
+
+from tempest import config
+import tempest.test
+
+from telemetry_tempest_plugin.scenario import utils
+
+CONF = config.CONF
+
+TEST_DIR = os.path.join(os.path.dirname(__file__),
+                        'telemetry_integration_prometheus_gabbits')
+
+
+class PrometheusGabbiTest(tempest.test.BaseTestCase):
+    credentials = ['admin']
+
+    TIMEOUT_SCALING_FACTOR = 5
+
+    @classmethod
+    def skip_checks(cls):
+        super(PrometheusGabbiTest, cls).skip_checks()
+        if not CONF.service_available.sg_core:
+            raise cls.skipException("sg-core support is required")
+
+    def _prep_test(self, filename):
+        os.environ.update({
+            "SG_CORE_SERVICE_URL":
+            str(config.CONF.telemetry.sg_core_service_url),
+        })
+
+
+utils.generate_tests(PrometheusGabbiTest, TEST_DIR)