Skip to content

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

Merged
merged 2 commits into from
Jul 28, 2025
Merged

chore(logs): Add more tests #96481

merged 2 commits into from
Jul 28, 2025

Conversation

wmak
Copy link
Member

@wmak 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)
Copy link
Contributor

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.

Locations (1)

Fix in CursorFix in Web

),
self.create_ourlog(
{"body": "bar"},
attributes={"sentry.observed_timestamp_nanos": str(self.nine_mins_ago.timestamp())},
Copy link
Contributor

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.

Locations (1)

Fix in CursorFix in Web

},
)
assert response.status_code == 200, response.content
assert [attrs for time, attrs in response.data["data"]] == [[{"count": 0}]] * 7
Copy link
Contributor

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.

Locations (1)

Fix in CursorFix in Web

Copy link

codecov bot commented Jul 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

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               

@wmak wmak merged commit 308a643 into master Jul 28, 2025
62 checks passed
@wmak wmak deleted the wmak/chore/add-more-logs-test branch July 28, 2025 17:34
andrewshie-sentry pushed a commit that referenced this pull request Aug 4, 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
Copy link

sentry-io bot commented Aug 7, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎

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.

2 participants