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
This commit is contained in:
Pavlo Shchelokovskyy 2020-10-05 12:05:15 +03:00
parent 566783bbed
commit 959fc69e49
2 changed files with 11 additions and 0 deletions

View File

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

View File

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