tests: Clear txn id on init for all debug loggers

Since we fake out all the greenthread stuff to run in the main thread,
we can (sometimes?) find that a transaction ID has already been set,
leading to failures in test_bad_request_app_logging like

    AssertionError: b'X-Trans-Id: test-trans-id' not found
    in b'X-Trans-Id: tx...'

By resetting the logger's txn_id, we're assured that our mock will be
run and the expected transaction ID will be used.

Change-Id: I465eed5372a2a5e591f80a09676f4b7f091cd444
This commit is contained in:
Tim Burke 2024-02-14 17:43:09 +00:00
parent 51ae9b00c9
commit 1ee9b1e3ba
1 changed files with 3 additions and 0 deletions

View File

@ -249,6 +249,9 @@ class DebugLogger(FakeLogger):
class DebugLogAdapter(utils.LogAdapter):
def __init__(self, *args, **kwargs):
super(DebugLogAdapter, self).__init__(*args, **kwargs)
self.txn_id = None
def __getattribute__(self, name):
try: