Fix sg-core test scenario.
The scenario assumed, there is an image in glance, which may
not always be the case. This patch creates a new image based
on path configured in CONF.scenario.img_file. To add this
functionality the TestTelemetryIntegrationPrometheus class
was moved to inherit from tempest.scenario.manager.ScenarioTest.
Requirements on glance and ceilometer were added too. Ceilometer
was required even before this change, but the requirement check
was missing.
The scenario assumed the ceilometer pipeline interval is less
than 2 minutes. This patch adds a config option for this.
By default 300s is used, which is the default interval when
installing devstack. It's then changed to 15s in .zuul.yaml,
which is the interval used in our tests.
Change-Id: Ifae664540fc5a749b2965822267d7c54b34a77a5
diff --git a/.zuul.yaml b/.zuul.yaml
index c90fa9b..5a821b6 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -59,6 +59,7 @@
metric_backends: gnocchi,prometheus
telemetry:
disable_ssl_certificate_validation: True
+ ceilometer_polling_interval: 15
tempest_test_regex: telemetry_tempest_plugin
tox_envlist: all
diff --git a/telemetry_tempest_plugin/config.py b/telemetry_tempest_plugin/config.py
index c8f757b..ed1017a 100644
--- a/telemetry_tempest_plugin/config.py
+++ b/telemetry_tempest_plugin/config.py
@@ -83,7 +83,10 @@
cfg.StrOpt('sg_core_service_url',
default="127.0.0.1:3000",
help="URL to sg-core prometheus endpoint"),
-
+ cfg.IntOpt('ceilometer_polling_interval',
+ default=300,
+ help="Polling interval configured for ceilometer. This can "
+ "be used in test cases to wait for metrics to appear.")
]
telemetry_services_opts = [
diff --git a/telemetry_tempest_plugin/scenario/telemetry_integration_prometheus_gabbits/ceilometer-sg-core-integration.yaml b/telemetry_tempest_plugin/scenario/telemetry_integration_prometheus_gabbits/ceilometer-sg-core-integration.yaml
index f4cd0b1..5568878 100644
--- a/telemetry_tempest_plugin/scenario/telemetry_integration_prometheus_gabbits/ceilometer-sg-core-integration.yaml
+++ b/telemetry_tempest_plugin/scenario/telemetry_integration_prometheus_gabbits/ceilometer-sg-core-integration.yaml
@@ -3,7 +3,7 @@
desc: Check the sg-core prometheus endpoint for ceilometer metrics
GET: $ENVIRON['SG_CORE_SERVICE_URL']/metrics
poll:
- count: 60
+ count: $ENVIRON['CEILOMETER_POLLING_INTERVAL']
delay: 2
response_strings:
- "ceilometer_image_size"
diff --git a/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py b/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py
index c379470..d4dcc0e 100644
--- a/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py
+++ b/telemetry_tempest_plugin/scenario/test_telemetry_integration_prometheus.py
@@ -13,7 +13,7 @@
import os
from tempest import config
-import tempest.test
+from tempest.scenario import manager
from telemetry_tempest_plugin.scenario import utils
@@ -23,22 +23,27 @@
'telemetry_integration_prometheus_gabbits')
-class PrometheusGabbiTest(tempest.test.BaseTestCase):
- credentials = ['admin']
+class PrometheusGabbiTest(manager.ScenarioTest):
+ credentials = ['admin', 'primary']
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")
+ for name in ["sg_core", "glance", "ceilometer"]:
+ if not getattr(CONF.service_available, name, False):
+ raise cls.skipException("%s support is required" %
+ name.capitalize())
def _prep_test(self, filename):
os.environ.update({
"SG_CORE_SERVICE_URL":
str(config.CONF.telemetry.sg_core_service_url),
+ "CEILOMETER_POLLING_INTERVAL":
+ str(CONF.telemetry.ceilometer_polling_interval),
})
+ self.image_create()
utils.generate_tests(PrometheusGabbiTest, TEST_DIR)