From 618ec054920b2e2d513c6340bdabec1e1d268955 Mon Sep 17 00:00:00 2001 From: Galen Date: Tue, 2 Jul 2024 16:58:17 -0700 Subject: [PATCH] manually refresh index post tile-save in search-export-test, re #10787 --- tests/search/search_export_tests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/search/search_export_tests.py b/tests/search/search_export_tests.py index 1d6876534fe..de216991372 100644 --- a/tests/search/search_export_tests.py +++ b/tests/search/search_export_tests.py @@ -7,6 +7,7 @@ from http import HTTPStatus from arches.app.models import models from arches.app.models.tile import Tile +from arches.app.search.search_engine_factory import SearchEngineFactory from arches.app.search.search_export import SearchResultsExporter from arches.app.utils.betterJSONSerializer import JSONDeserializer from arches.app.utils.data_management.resource_graphs.importer import ( @@ -79,7 +80,8 @@ def setUpTestData(cls): resourceinstance_id=cls.test_resourceinstanceid, ) cultural_period_tile.save() - time.sleep(5) # delay to allow for async indexing + se = SearchEngineFactory().create() + sync_es(se, index="test_resources") # TODO: create geospatial test data def test_cultural_period_node_exportable(self): @@ -217,3 +219,7 @@ def is_valid_uuid(value, version=4): return str(uuid_obj) == value except ValueError: return False + + +def sync_es(search_engine, index="test"): + search_engine.es.indices.refresh(index=index)