-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
chore(logs): Add more tests #96481
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
chore(logs): Add more tests #96481
Conversation
wmak
commented
Jul 25, 2025
- After refactoring the rpc modules to classes there was bug in the logs code. This adds the homepage queries as tests to avoid this in the future and adds more events-stats tests since we didn't have any
- After refactoring the rpc modules to classes there was bug in the logs code. This adds the homepage queries as tests to avoid this in the future and adds more events-stats tests since we didn't have any
def _do_request(self, data, url=None, features=None): | ||
if features is None: | ||
features = {"organizations:ourlogs": True} | ||
features.update(self.features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test Setup Error: Missing Feature Initialization
The _do_request
method attempts to use self.features
without it being initialized in setUp
, leading to an AttributeError
. Additionally, the test uses the incorrect feature flag organizations:ourlogs
instead of organizations:ourlogs-enabled
, which will prevent the feature from being properly enabled during tests.
), | ||
self.create_ourlog( | ||
{"body": "bar"}, | ||
attributes={"sentry.observed_timestamp_nanos": str(self.nine_mins_ago.timestamp())}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Timestamp Units Mismatch in Sentry
The sentry.observed_timestamp_nanos
attribute is incorrectly set to seconds. The timestamp()
method returns seconds, but the attribute name implies nanoseconds. The value should be multiplied by 1,000,000,000 to convert it to nanoseconds, aligning with similar nanosecond-based timestamps in the codebase.
}, | ||
) | ||
assert response.status_code == 200, response.content | ||
assert [attrs for time, attrs in response.data["data"]] == [[{"count": 0}]] * 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Time Interval Test Mismatch
The test_zerofill
method contains an off-by-one error, incorrectly expecting 7 intervals for a 6-hour time range with 1-hour intervals. This is inconsistent with the test_count
method, which correctly expects 6 intervals for the identical time range.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #96481 +/- ##
===========================================
+ Coverage 37.98% 87.74% +49.76%
===========================================
Files 10011 10653 +642
Lines 561649 614692 +53043
Branches 24158 24158
===========================================
+ Hits 213318 539372 +326054
+ Misses 348041 75030 -273011
Partials 290 290 |
- After refactoring the rpc modules to classes there was bug in the logs code. This adds the homepage queries as tests to avoid this in the future and adds more events-stats tests since we didn't have any
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |