Skip to content

Commit

Permalink
Log extra queries
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed Sep 25, 2024
1 parent 6ad66ad commit a8cbe6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ralph/api/tests/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,8 @@ def test_json_endpoint(self, model_name):
response = self.client.get(endpoint, HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertGreater(len(response.json()['results']), 0)
self.assertLessEqual(len(cqc.captured_queries), max_queries)
self.assertLessEqual(len(cqc.captured_queries), max_queries,
msg=f"Too many queries when getting {endpoint}."
f"\nQueries count: {len(cqc.captured_queries)}."
"\nQueries:\n" + "\n".join(query['sql'] for query in cqc.captured_queries)
)

0 comments on commit a8cbe6f

Please sign in to comment.