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
This commit is contained in:
Jaromir Wysoglad 2024-02-19 10:26:11 -05:00 committed by Jaromír Wysoglad
parent 74d1968199
commit b8fd0674ad
4 changed files with 16 additions and 7 deletions

View File

@ -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

View File

@ -83,7 +83,10 @@ TelemetryGroup = [
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 = [

View File

@ -3,7 +3,7 @@ tests:
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"

View File

@ -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 @@ TEST_DIR = os.path.join(os.path.dirname(__file__),
'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)