From 3d6b61d8d2b11b7a10190202d91bce0271162efd Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 26 Jun 2024 09:19:51 +0200 Subject: [PATCH] fix flakyness for real --- meilisearch/tests/tasks/mod.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/meilisearch/tests/tasks/mod.rs b/meilisearch/tests/tasks/mod.rs index 89e6ff2c8..f2ed76b6a 100644 --- a/meilisearch/tests/tasks/mod.rs +++ b/meilisearch/tests/tasks/mod.rs @@ -766,7 +766,31 @@ async fn test_summarized_index_deletion() { "###); // is the details correctly set when documents are actually deleted. - index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await; + // /!\ We need to wait for the document addition to be processed otherwise, if the test runs too slow, + // both tasks may get autobatched and the deleted documents count will be wrong. + let (ret, _code) = + index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await; + let task = index.wait_task(ret.uid()).await; + snapshot!(task, + @r###" + { + "uid": 1, + "indexUid": "test", + "status": "succeeded", + "type": "documentAdditionOrUpdate", + "canceledBy": null, + "details": { + "receivedDocuments": 1, + "indexedDocuments": 1 + }, + "error": null, + "duration": "[duration]", + "enqueuedAt": "[date]", + "startedAt": "[date]", + "finishedAt": "[date]" + } + "###); + let (ret, _code) = index.delete().await; let task = index.wait_task(ret.uid()).await; snapshot!(task,