fix flakyness for real

This commit is contained in:
Tamo 2024-06-26 09:19:51 +02:00
parent 1374b661d1
commit 3d6b61d8d2

View File

@ -766,7 +766,31 @@ async fn test_summarized_index_deletion() {
"###); "###);
// is the details correctly set when documents are actually deleted. // 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 (ret, _code) = index.delete().await;
let task = index.wait_task(ret.uid()).await; let task = index.wait_task(ret.uid()).await;
snapshot!(task, snapshot!(task,