chore(tests): Correct regex that was supposed to filter Singer output from CI logs - #608
Merged
Merged
Conversation
…rom CI logs
tests/fixtures.py already installs a FilterStdOutput wrapper around
sys.stdout to hide RECORD/SCHEMA/STATE messages during test runs (CI
uses `pytest --capture=no`, so these otherwise print straight to the
job log). Its regex, r'{"type": ' (with a space after the colon),
never matched anything: singer-sdk serializes messages with compact
JSON separators, e.g. {"type":"RECORD",...} with no space. The filter
has therefore never actually filtered, letting every RECORD (including
large ones like PR diffs) print directly into CI logs.
Fix the pattern to match the real compact format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{"type":"RECORD",...},{"type":"SCHEMA",...}, etc.), sometimes multi-KB per line (e.g. full PR diffs embedded inissue_commentsrecords) — see this failing run for an example.tests/fixtures.pyalready anticipated this: since CI runspytest --capture=no, it installssys.stdout = FilterStdOutput(sys.stdout, r'{"type": ')at collection time specifically to hide Singer messages from the live log.r'{"type": 'has a space after the colon, butsinger-sdkserializes messages with compact JSON separators —{"type":"RECORD",...}, no space. The pattern therefore never matched anything, so the filter has silently done nothing since it was added.Changes
r'{"type":"', matching the SDK's actual compact output.Test plan
pytest tests/test_tap.py -k test_get_a_repository_in_repo_list_mode --capture=no -qbefore/after the fix. Before: raw{"type":"SCHEMA",...}lines print directly to the terminal. After: those lines are gone; only structuredloggingoutput (which goes through a separate channel, e.g.METRIC: {"type":"timer",...}) remains.ruff check/ruff format --checkpasstests/test_authenticator.py(unaffected unit tests) still pass