Skip to content

wip(tests): Working example of broken testcase #94891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leeandher
Copy link
Member

TL;DR -> Trying to save a performance issue while within the freeze_time ctx will have inconsistent behaviour whether or not we are in the default 90 day retention, and whether or not the value it uses is dynamic. This odd behavior can lead to issues since writing tests and freezing today's date will cause the test to fail 90d from now :(


I spent a while debugging this and noticed normalize seems like a relay function which overrides the event data's timestamp, but even if we skip normalization the event is not saved correctly, and cant be accessed with group.get_latest_event(). I think another storage somewhere else is overriding the event timestamp when its inserted.

I dont understand the how the storage and query mechanisms underneath work well enough to trace where exactly the retention days check is causing issues, so I wrote some failing tests to share with SMEs.

Copy link

codecov bot commented Jul 3, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
27181 2 27179 251
View the top 2 failed test(s) by shortest run time
tests.sentry.debug.test_incompatibility.IncompatibilityTest::test_outside_retention
Stack Traces | 2.92s run time
#x1B[1m#x1B[.../sentry/debug/test_incompatibility.py#x1B[0m:82: in test_outside_retention
    assert stored_event.timestamp.startswith("2025-02-14")
#x1B[1m#x1B[31mE   AssertionError: assert False#x1B[0m
#x1B[1m#x1B[31mE    +  where False = <built-in method startswith of str object at 0x7f5016cc4ad0>('2025-02-14')#x1B[0m
#x1B[1m#x1B[31mE    +    where <built-in method startswith of str object at 0x7f5016cc4ad0> = '2025-07-03T21:16:42+00:00'.startswith#x1B[0m
#x1B[1m#x1B[31mE    +      where '2025-07-03T21:16:42+00:00' = <sentry.eventstore.models.GroupEvent object at 0x7f503f73bac0>.timestamp#x1B[0m
tests.sentry.debug.test_incompatibility.IncompatibilityTest::test_within_retention_dynamic
Stack Traces | 3.16s run time
#x1B[1m#x1B[.../sentry/debug/test_incompatibility.py#x1B[0m:61: in test_within_retention_dynamic
    assert stored_event.timestamp == perf_event.timestamp
#x1B[1m#x1B[31mE   AssertionError: assert '2025-07-03T21:13:40+00:00' == '2025-07-03T2....688000+00:00'#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE     - 2025-07-03T21:13:40.688000+00:00#x1B[0m
#x1B[1m#x1B[31mE     ?                    -------#x1B[0m
#x1B[1m#x1B[31mE     + 2025-07-03T21:13:40+00:00#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

1 participant