From 3ef4d4b59b5faed618b3890d678065f874c636fe Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Thu, 3 Oct 2024 16:32:20 -0400 Subject: [PATCH] ES: fix another flaky test (#11647) ES: fix another flaky tes Similar to https://github.com/readthedocs/readthedocs.org/pull/11640/ --- readthedocs/search/tests/test_faceted_search.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/readthedocs/search/tests/test_faceted_search.py b/readthedocs/search/tests/test_faceted_search.py index 54406d44f9c..c83c5294a86 100644 --- a/readthedocs/search/tests/test_faceted_search.py +++ b/readthedocs/search/tests/test_faceted_search.py @@ -24,13 +24,14 @@ def test_search_exact_match(self, client, project, case): results = page_search.execute() assert len(results) == 2 - assert results[0]["project"] == "kuma" - assert results[0]["path"] == "testdocumentation" - assert results[0]["version"] == "latest" - assert results[1]["project"] == "kuma" - assert results[1]["path"] == "testdocumentation" - assert results[1]["version"] == "stable" + # Both versions have the same exact content. + # Order of results is not deterministic anymore for some reason, + # so we use a set to compare the results. + assert {result["version"] for result in results} == {"stable", "latest"} + for result in results: + assert result["project"] == "kuma" + assert result["path"] == "testdocumentation" def test_search_combined_result(self, client, project): """Check search result are combined of both `AND` and `OR` operator