Skip to content

tests(resolve_groups): Clean up the tests #91779

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 5 commits into from
May 20, 2025
Merged

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented May 15, 2025

This fixes and makes it clearer some of the tests for resolving groups.

@@ -240,7 +240,7 @@ def setUp(self):
self.secret = "b3002c3e321d4b7880360d397db2ccfd"
options.set("github-app.webhook-secret", self.secret)

def _setup_repo_test(self, project):
def _create_integration_and_send_push_event(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 makes it clearer what this helper function does.

@@ -576,7 +576,7 @@ def setUp(self):
self.secret = "b3002c3e321d4b7880360d397db2ccfd"
options.set("github-app.webhook-secret", self.secret)

def _setup_repo_test(self, project):
def _create_integration_and_send_pull_request_opened_event(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 makes it clearer what this helper function does.

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 whole test we may want to delete, as I believe it may be converted by tests for event_manager or webhooks.

linked_type=GroupLink.LinkedType.pull_request,
linked_id=pr.id,
).exists()
# XXX: Oddly,resolved_in_pull_request doesn't update the group status
Copy link
Member Author

Choose a reason for hiding this comment

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

Unlike resolved_in_commit, this function doesn't resolve the group. Maybe it's intentional.

GroupLink.objects.create(
group_id=group.id,
project_id=group.project_id,
linked_type=GroupLink.LinkedType.pull_request,
relationship=GroupLink.Relationship.resolves,
linked_id=instance.id,
)
acting_user: RpcUser | None = None
if user_list:
acting_user = user_list[0]
GroupAssignee.objects.assign(
group=group, assigned_to=acting_user, acting_user=acting_user
)
Activity.objects.create(
project_id=group.project_id,
group=group,
type=ActivityType.SET_RESOLVED_IN_PULL_REQUEST.value,
ident=instance.id,
user_id=acting_user.id if acting_user else None,
data={"pull_request": instance.id},
)
record_group_history(
group, GroupHistoryStatus.SET_RESOLVED_IN_PULL_REQUEST, actor=acting_user
)

@armenzg armenzg requested review from a team and scttcper May 15, 2025 22:43
@armenzg armenzg marked this pull request as ready for review May 15, 2025 22:44
Copy link

codecov bot commented May 15, 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   #91779      +/-   ##
==========================================
+ Coverage   78.83%   87.65%   +8.82%     
==========================================
  Files       10333    10336       +3     
  Lines      586475   586181     -294     
  Branches    22548    22548              
==========================================
+ Hits       462337   513843   +51506     
+ Misses     123692    71892   -51800     
  Partials      446      446              

@armenzg armenzg merged commit 2fd4d9c into master May 20, 2025
57 checks passed
@armenzg armenzg deleted the tests/resolve_commits/armenzg branch May 20, 2025 11:48
jan-auer added a commit that referenced this pull request May 20, 2025
* master: (58 commits)
  link: cleanup link (#91687)
  ref: create project_id index for organizationonboardingtask (#91918)
  storybook: smaller last edited (#91875)
  issues: fix chonk stacktrace alignment (#91891)
  alert: drop custom alert (#91892)
  insights: fix bar height (#91895)
  ref(span-buffer): Move max-memory-percentage to right CLI (#91924)
  ref(js): Factor button functionality (#91763)
  tests(resolve_groups): Clean up the tests (#91779)
  ref(span-buffer): Add backpressure (#91707)
  fix(nextjs-insights): project id is not passed to explore link (#91920)
  fix(crons): Floor seconds / microsecond on recorded dateClock (#91890)
  fix(uptime): Fix bug with the uptime_checks dataset in the events endpoint (#91824)
  ref: add state-only migration to reflect existing indexes in prod (#91901)
  ref: remove unnecssary metaclass (#91906)
  fix(stats): use data category title name (#91913)
  feat(issues): Add success messages to some actions (#91899)
  test(taskworker): Lower exec time (#91907)
  chore(aci): manually add spans for delayed workflow processing (#91908)
  chore(aci): remove uses of WorkflowFireHistory rollout columns (#91904)
  ...
andrewshie-sentry pushed a commit that referenced this pull request May 20, 2025
This fixes and makes it clearer some of the tests for resolving groups.
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