Mock log_opt_values in API tests & fix auth_url in devstack

A recent commit [0] sets log_opt_values to INFO in order to display
config options even if DEBUG is not enabled, but it makes our functional
tests 3 times slower because each api test dumps the configuration.

Mock log_opt_values in our API functional tests to speed up the
execution of the tests.

$OS_AUTH_URL was previously used to configure the service_auth.auth_url
setting in octavia.conf but this env var was removed from devstack in
[1]. Switch to $KEYSTONE_SERVICE_URI which was used to set OS_AUTH_URL.

[0] https://review.opendev.org/c/openstack/octavia/+/792697
[1] I86ffa9cd52454f1c1c72d29b3a0e0caa3e44b829

Change-Id: Ib9123365079502093b355db3430a98928a3a16d1
This commit is contained in:
Gregory Thiemonge 2021-11-17 12:03:56 +01:00
parent f48141f43b
commit 237d443649
3 changed files with 9 additions and 1 deletions

View File

@ -312,7 +312,7 @@ function octavia_configure {
configure_keystone_authtoken_middleware $OCTAVIA_CONF octavia
# Ensure config is set up properly for authentication as admin
iniset $OCTAVIA_CONF service_auth auth_url $OS_AUTH_URL
iniset $OCTAVIA_CONF service_auth auth_url $KEYSTONE_SERVICE_URI
iniset $OCTAVIA_CONF service_auth auth_type password
iniset $OCTAVIA_CONF service_auth username $OCTAVIA_USERNAME
iniset $OCTAVIA_CONF service_auth password $OCTAVIA_PASSWORD

View File

@ -48,6 +48,10 @@ class TestHealthCheck(base_db_test.OctaviaDBTestBase):
cfg.CONF.register_opts(healthcheck_opts, group='healthcheck')
self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
# Mock log_opt_values, it prevents the dump of the configuration
# with LOG.info for each test. It saves a lot of time when running
# the functional tests.
self.conf.conf.log_opt_values = mock.MagicMock()
self.conf.config(group='healthcheck', backends=['octavia_db_check'])
self.conf.config(group='api_settings', healthcheck_refresh_interval=5)
self.UNAVAILABLE = (healthcheck_plugins.OctaviaDBHealthcheck.

View File

@ -101,6 +101,10 @@ class BaseAPITest(base_db_test.OctaviaDBTestBase):
def setUp(self):
super().setUp()
self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
# Mock log_opt_values, it prevents the dump of the configuration
# with LOG.info for each test. It saves a lot of time when running
# the functional tests.
self.conf.conf.log_opt_values = mock.MagicMock()
self.conf.config(group="controller_worker",
network_driver='network_noop_driver')
self.conf.config(group='api_settings', auth_strategy=constants.NOAUTH)