Browse Source

debug(tests): Added some debugging for flakey ado test (#33632)

* debug(tests): Added some debugging for flakey ado test

Occasionaly, we see the ado create issue test fail. I'm suspecting that the mock URL isn't getting added to the responses. I want to verify that as well as be able to see what individual values are in the issue.

This change will be reverted after debugging is complete

* Forcing a issue to be made

* Removed forced error
Aniket Das "Tekky 2 years ago
parent
commit
fa7833f55a
1 changed files with 13 additions and 3 deletions
  1. 13 3
      tests/sentry/integrations/vsts/test_notify_action.py

+ 13 - 3
tests/sentry/integrations/vsts/test_notify_action.py

@@ -50,7 +50,9 @@ class AzureDevopsCreateTicketActionTest(RuleTestCase, VstsIssueBase):
                 "integration": self.integration.model.id,
             }
         )
-        azuredevops_rule.rule = Rule.objects.create(project=self.project, label="test rule")
+        debug_data_capture = azuredevops_rule.data  # noqa: F841
+        debug_rule_obj = Rule.objects.create(project=self.project, label="test rule")
+        azuredevops_rule.rule = debug_rule_obj
         responses.add(
             responses.PATCH,
             "https://fabrikam-fiber-inc.visualstudio.com/0987654321/_apis/wit/workitems/$Microsoft.VSTS.WorkItemTypes.Task",
@@ -58,11 +60,19 @@ class AzureDevopsCreateTicketActionTest(RuleTestCase, VstsIssueBase):
             content_type="application/json",
         )
 
-        results = list(azuredevops_rule.after(event=event, state=self.get_state()))
+        debug_response_urls = [mock.url for mock in responses._default_mock._matches]  # noqa: F841
+        debug_response_bodies = [  # noqa: F841
+            mock.body for mock in responses._default_mock._matches
+        ]
+
+        debug_state = self.get_state()
+        after_res = azuredevops_rule.after(event=event, state=debug_state)
+        results = list(after_res)
         assert len(results) == 1
 
         # Trigger rule callback
-        rule_future = RuleFuture(rule=azuredevops_rule, kwargs=results[0].kwargs)
+        debug_kwargs = results[0].kwargs
+        rule_future = RuleFuture(rule=azuredevops_rule, kwargs=debug_kwargs)
         results[0].callback(event, futures=[rule_future])
         data = json.loads(responses.calls[0].response.text)