diff options
author | Zuul <zuul@review.opendev.org> | 2022-09-22 22:36:22 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-09-22 22:36:22 +0000 |
commit | 6fa84faf3fb595dd8d80a6583891dc4f2e8043d2 (patch) | |
tree | e767185eed616e1537792d672c9263b51d09896a /tests/base.py | |
parent | fd6af2931b3610fa80cd2d6d7ed6a035da27233d (diff) | |
parent | ce40b296776caf8ca76825befa35c4b166488e11 (diff) | |
download | zuul-6fa84faf3fb595dd8d80a6583891dc4f2e8043d2.tar.gz |
Merge "Add support for configuring and testing tracing"
Diffstat (limited to 'tests/base.py')
-rw-r--r-- | tests/base.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/base.py b/tests/base.py index cf6296f62..b85bce504 100644 --- a/tests/base.py +++ b/tests/base.py @@ -125,6 +125,8 @@ from zuul.lib.logutil import get_annotated_logger import tests.fakegithub import tests.fakegitlab +from tests.otlp_fixture import OTLPFixture +import opentelemetry.sdk.trace.export FIXTURE_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') @@ -4921,6 +4923,15 @@ class ZuulTestCase(BaseTestCase): if 'database' in config.sections(): _setup_fixture(config, 'database') + if 'tracing' in config.sections(): + self.otlp = OTLPFixture() + self.useFixture(self.otlp) + self.useFixture(fixtures.MonkeyPatch( + 'zuul.lib.tracing.Tracing.processor_class', + opentelemetry.sdk.trace.export.SimpleSpanProcessor)) + config.set('tracing', 'endpoint', + f'http://localhost:{self.otlp.port}') + if not self.setupSimpleLayout(config): tenant_config = None for cfg_attr in ('tenant_config', 'tenant_config_script'): @@ -5207,6 +5218,7 @@ class ZuulTestCase(BaseTestCase): and not t.name.startswith('Dummy-') and not t.name.startswith('pydevd.') and not t.name.startswith('ptvsd.') + and not t.name.startswith('OTLPFixture_') ] if len(threads) > 1: thread_map = dict(map(lambda x: (x.ident, x.name), |