Skip to content

chore: Update tests for structured logs - #1224

Merged
tustanivsky merged 6 commits into
mainfrom
chore/log-attr-tests
Feb 13, 2026
Merged

chore: Update tests for structured logs#1224
tustanivsky merged 6 commits into
mainfrom
chore/log-attr-tests

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

The existing unit tests for BeforeLogHandler and log attributes had two major issues:

  • Test stability and isolation: The tests required subsystem re-initialization mid-test (InitializeWithSettings), which caused flakiness and interfered with subsequent tests. In some cases, running these tests left the editor session in a broken state where the sample app became unusable in Play Mode (PIE).

  • Lack of end-to-end validation: The tests were shallow: they only verified that the handler was invoked and received the correct data in-process. They never validated that the modified log actually reached Sentry with the expected attributes. As a result, a passing unit test did not guarantee the feature worked end-to-end.

Key changes:

  • Removed problematic unit tests for BeforeLogHandler and global log attributes
  • Added e2e coverage for the same scenarios in desktop and Android integration tests:
    • BeforeLogHandler adding and removing attributes
    • Global attributes set via SentrySubsystem->SetAttribute() attached to logs
    • Global attributes removed via SentrySubsystem->RemoveAttribute() not appearing on logs
  • Added CppBeforeLogHandler to the sample app, wired via -ini: settings override in tests
  • Extended RunLogTest() to exercise global attribute set/remove before sending the log

Depends on:

Related items:

#skip-changelog

@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

Android's SetAttribute/RemoveAttribute on the subsystem are no-ops
(sentry-java doesn't support global log attributes). These are
tested in desktop tests only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tustanivsky
tustanivsky marked this pull request as ready for review February 11, 2026 16:09
@tustanivsky
tustanivsky merged commit 0ab00a0 into main Feb 13, 2026
123 of 146 checks passed
@tustanivsky
tustanivsky deleted the chore/log-attr-tests branch February 13, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants