Просмотр исходного кода

chore(github-comments): fix flaky test (#63032)

Fixes SENTRY-TESTS-QRW
([link](https://sentry.sentry.io/issues/4740260799/))
Cathy Teng 1 год назад
Родитель
Сommit
1115f9d033
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      tests/sentry/tasks/integrations/github/test_pr_comment.py

+ 3 - 1
tests/sentry/tasks/integrations/github/test_pr_comment.py

@@ -348,6 +348,8 @@ class TestCommentWorkflow(GithubCommentTestCase):
     @responses.activate
     def test_comment_workflow(self, mock_metrics, mock_issues):
         groups = [g.id for g in Group.objects.all()]
+        titles = [g.title for g in Group.objects.all()]
+        culprits = [g.culprit for g in Group.objects.all()]
         mock_issues.return_value = [{"group_id": id, "event_count": 10} for id in groups]
 
         responses.add(
@@ -361,7 +363,7 @@ class TestCommentWorkflow(GithubCommentTestCase):
 
         assert (
             responses.calls[0].request.body
-            == f'{{"body": "## Suspect Issues\\nThis pull request was deployed and Sentry observed the following issues:\\n\\n- \\u203c\\ufe0f **issue 1** `issue1` [View Issue](http://testserver/organizations/foo/issues/{groups[0]}/?referrer=github-pr-bot)\\n- \\u203c\\ufe0f **issue 2** `issue2` [View Issue](http://testserver/organizations/foobar/issues/{groups[1]}/?referrer=github-pr-bot)\\n\\n<sub>Did you find this useful? React with a \\ud83d\\udc4d or \\ud83d\\udc4e</sub>"}}'.encode()
+            == f'{{"body": "## Suspect Issues\\nThis pull request was deployed and Sentry observed the following issues:\\n\\n- \\u203c\\ufe0f **{titles[0]}** `{culprits[0]}` [View Issue](http://testserver/organizations/foo/issues/{groups[0]}/?referrer=github-pr-bot)\\n- \\u203c\\ufe0f **{titles[1]}** `{culprits[1]}` [View Issue](http://testserver/organizations/foobar/issues/{groups[1]}/?referrer=github-pr-bot)\\n\\n<sub>Did you find this useful? React with a \\ud83d\\udc4d or \\ud83d\\udc4e</sub>"}}'.encode()
         )
         pull_request_comment_query = PullRequestComment.objects.all()
         assert len(pull_request_comment_query) == 1