Skip to content

ref(grouping): Rewrite hierarchical grouping tests #74144

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 9 commits into from
Jul 12, 2024

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Jul 11, 2024

This makes the tests a little easier to understand and prepares for my next set of changes.

@armenzg armenzg changed the base branch from master to chore/move_tests/grouping/armenzg July 11, 2024 16:46
@armenzg armenzg changed the base branch from chore/move_tests/grouping/armenzg to master July 11, 2024 17:30
@armenzg armenzg force-pushed the ref/hierachical_tests/armenzg branch from cd36ba6 to 59a104d Compare July 11, 2024 17:31
@@ -202,54 +202,18 @@ def test_partial_move(default_project, fast_save):


class EventManagerGroupingTest(TestCase):
def test_applies_secondary_grouping_hierarchical(self):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is easier to review with the split view
image

def test_applies_secondary_grouping_hierarchical(self):
project = self.project
project.update_option("sentry:grouping_config", "legacy:2019-03-12")
project.update_option("sentry:secondary_grouping_expiry", 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 lines now live in the shared function set_options:
image

project.update_option("sentry:grouping_config", "legacy:2019-03-12")
project.update_option("sentry:secondary_grouping_expiry", 0)

timestamp = time.time() - 300
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

save_event will not use timestamp anymore.


timestamp = time.time() - 300

def save_event(ts_offset):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has been converted into a helper function. See down below.

return manager.save(project.id)

event = save_event(0)
def test_can_upgrade_to_hierarchical_config(self):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More meaningful naming.


project.update_option("sentry:grouping_config", "mobile:2021-02-12")
project.update_option("sentry:secondary_grouping_config", "legacy:2019-03-12")
project.update_option("sentry:secondary_grouping_expiry", time.time() + (24 * 90 * 3600))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 lines have been moved into a helper function.
image

manager = EventManager(
make_event(
message="foo 123",
event_id=hex(2**127)[-32:],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the timestamp offset was not necessary. Two events can still have the same ID.
image

@armenzg armenzg force-pushed the ref/hierachical_tests/armenzg branch from 782bcf3 to 91c244c Compare July 11, 2024 17:42
@armenzg armenzg marked this pull request as ready for review July 11, 2024 17:43
@armenzg armenzg requested a review from a team as a code owner July 11, 2024 17:43
@armenzg armenzg requested a review from lobsterkatie July 11, 2024 17:43
@armenzg armenzg self-assigned this Jul 11, 2024
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.20%. Comparing base (5a712c1) to head (91c244c).
Report is 13 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #74144       +/-   ##
===========================================
+ Coverage   54.35%   78.20%   +23.84%     
===========================================
  Files        5605     6660     +1055     
  Lines      236523   297354    +60831     
  Branches    40529    51176    +10647     
===========================================
+ Hits       128566   232548   +103982     
+ Misses     106482    58492    -47990     
- Partials     1475     6314     +4839     

see 2314 files with indirect coverage changes

@armenzg armenzg merged commit 2a0df0c into master Jul 12, 2024
47 checks passed
@armenzg armenzg deleted the ref/hierachical_tests/armenzg branch July 12, 2024 13:00
priscilawebdev pushed a commit that referenced this pull request Jul 13, 2024
This makes the tests a little easier to understand and prepares for my
next set of changes.
@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants