Intermittently failing MLClass filter unit test on ListElementParents
From these CI logs:
======================================================================
FAIL: test_class_filter_list_parents (arkindex.documents.tests.test_classes.TestClasses)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builds/arkindex/backend/arkindex/documents/tests/test_classes.py", line 408, in test_class_filter_list_parents
data={'type': self.classified.slug, 'best_class': str(self.text.id)}
File "/usr/local/lib/python3.7/site-packages/django/test/testcases.py", line 87, in __exit__
'%d. %s' % (i, query['sql']) for i, query in enumerate(self.captured_queries, start=1)
AssertionError: 1 != 5 : 1 queries executed, 5 expected
Captured queries were:
1. SELECT COUNT(*) FROM (SELECT DISTINCT "documents_element"."id" AS Col1, "documents_element"."created" AS Col2, "documents_element"."updated" AS Col3, "documents_element"."corpus_id" AS Col4, "documents_element"."type_id" AS Col5, "documents_element"."name" AS Col6, "documents_element"."zone_id" AS Col7, "documents_element"."source_id" AS Col8, "documents_element"."worker_version_id" AS Col9 FROM "documents_element" INNER JOIN "documents_elementtype" ON ("documents_element"."type_id" = "documents_elementtype"."id") INNER JOIN "documents_classification" ON ("documents_element"."id" = "documents_classification"."element_id") WHERE ("documents_element"."id" IN (SELECT U0."path"[array_length(U0."path", 1)] FROM "documents_elementpath" U0 WHERE U0."element_id" = 'b018e2de-1757-432f-91ed-4377a3a3f546'::uuid) AND "documents_element"."corpus_id" IN (SELECT U0."id" FROM "documents_corpus" U0 WHERE U0."public") AND "documents_elementtype"."slug" = 'classified' AND ("documents_classification"."state" = 'validated' OR "documents_classification"."high_confidence") AND "documents_classification"."ml_class_id" = 'd4cee89d-b8fa-42ec-b3c8-94187a690a08'::uuid)) subquery