commit 959fc69e492ed1d2297cce624c1efbf79e9f1b66 Author: Pavlo Shchelokovskyy Date: Mon Oct 5 12:05:15 2020 +0300 Allow to disable SSL validation in gabbi tests Gabbi does not allow to pass custom path to (self-signed) SSL certs, so we can't really re-use the CONF.identity option (as does the AODH test client). This patch adds a new config option CONF.telemetry.disable_ssl_certificate_validation (False by default) that will disable SSL cert validation when running gabbits. For comparison, see similar patch to heat's tempest plugin https://review.opendev.org/#/c/703335 Change-Id: I298c8ebb45f0768b12919cf4f67462df0ff4c631 diff --git a/telemetry_tempest_plugin/config.py b/telemetry_tempest_plugin/config.py index e076faf..403bc9c 100644 --- a/telemetry_tempest_plugin/config.py +++ b/telemetry_tempest_plugin/config.py @@ -70,6 +70,10 @@ TelemetryGroup = [ cfg.IntOpt('alarm_threshold', default=10, help="Threshold to cross for the alarm to trigger."), + cfg.BoolOpt("disable_ssl_certificate_validation", + default=False, + help="Disable SSL certificate validation when running " + "scenario tests"), ] event_opts = [ diff --git a/telemetry_tempest_plugin/scenario/utils.py b/telemetry_tempest_plugin/scenario/utils.py index f17c233..0904160 100644 --- a/telemetry_tempest_plugin/scenario/utils.py +++ b/telemetry_tempest_plugin/scenario/utils.py @@ -16,13 +16,20 @@ import unittest from gabbi import runner from gabbi import suitemaker from gabbi import utils +from oslo_config import cfg from oslo_log import log as logging LOG = logging.getLogger(__name__) +CONF = cfg.CONF def run_test(test_class_instance, test_dir, filename): d = utils.load_yaml(yaml_file=os.path.join(test_dir, filename)) + cert_validate = not CONF.telemetry.disable_ssl_certificate_validation + if 'defaults' in d: + d['defaults']['cert_validate'] = cert_validate + else: + d['defaults'] = {'cert_validate': cert_validate} test_suite = suitemaker.test_suite_from_dict( loader=unittest.defaultTestLoader, test_base_name="gabbi",