From ed7c06e25f8311383b3c11503f8bef30833edc29 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 2 Oct 2024 14:07:41 -0400 Subject: [PATCH] ES: fix flaky test (#11640) I think this broke with https://github.com/readthedocs/readthedocs.org/pull/11566/, I didn't find anything obvious from their changelog, and doesn't look like something I want to spend more time on debugging... --- readthedocs/search/tests/test_views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/readthedocs/search/tests/test_views.py b/readthedocs/search/tests/test_views.py index 976be1c072f..2bb090b19d9 100644 --- a/readthedocs/search/tests/test_views.py +++ b/readthedocs/search/tests/test_views.py @@ -260,8 +260,10 @@ def test_file_search_exact_match(self, client, project): # There are two results, # one from each version of the "kuma" project. assert len(results) == 2 - assert results[0]["version"] == {"slug": "latest"} - assert results[1]["version"] == {"slug": "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"]["slug"] for result in results} == {"stable", "latest"} for result in results: assert result["project"] == {"alias": None, "slug": "kuma"} assert result["domain"] == "http://kuma.readthedocs.io"