Skip to content

Commit fa7833f

Browse files
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
1 parent 83d062f commit fa7833f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/sentry/integrations/vsts/test_notify_action.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,29 @@ def test_create_issue(self):
5050
"integration": self.integration.model.id,
5151
}
5252
)
53-
azuredevops_rule.rule = Rule.objects.create(project=self.project, label="test rule")
53+
debug_data_capture = azuredevops_rule.data # noqa: F841
54+
debug_rule_obj = Rule.objects.create(project=self.project, label="test rule")
55+
azuredevops_rule.rule = debug_rule_obj
5456
responses.add(
5557
responses.PATCH,
5658
"https://fabrikam-fiber-inc.visualstudio.com/0987654321/_apis/wit/workitems/$Microsoft.VSTS.WorkItemTypes.Task",
5759
body=WORK_ITEM_RESPONSE,
5860
content_type="application/json",
5961
)
6062

61-
results = list(azuredevops_rule.after(event=event, state=self.get_state()))
63+
debug_response_urls = [mock.url for mock in responses._default_mock._matches] # noqa: F841
64+
debug_response_bodies = [ # noqa: F841
65+
mock.body for mock in responses._default_mock._matches
66+
]
67+
68+
debug_state = self.get_state()
69+
after_res = azuredevops_rule.after(event=event, state=debug_state)
70+
results = list(after_res)
6271
assert len(results) == 1
6372

6473
# Trigger rule callback
65-
rule_future = RuleFuture(rule=azuredevops_rule, kwargs=results[0].kwargs)
74+
debug_kwargs = results[0].kwargs
75+
rule_future = RuleFuture(rule=azuredevops_rule, kwargs=debug_kwargs)
6676
results[0].callback(event, futures=[rule_future])
6777
data = json.loads(responses.calls[0].response.text)
6878

0 commit comments

Comments
 (0)