From 7e355958e019f1e05612b38a9c509b1b94b03673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 27 Oct 2022 10:57:32 +0200 Subject: [PATCH] Await the last insert task --- meilisearch-http/tests/auth/authorization.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/meilisearch-http/tests/auth/authorization.rs b/meilisearch-http/tests/auth/authorization.rs index 53f03e9a4..c7fb72132 100644 --- a/meilisearch-http/tests/auth/authorization.rs +++ b/meilisearch-http/tests/auth/authorization.rs @@ -272,7 +272,8 @@ async fn access_authorized_stats_restricted_index() { let index = server.index("products"); let (response, code) = index.create(Some("product_id")).await; assert_eq!(202, code, "{:?}", &response); - index.wait_task(0).await; + let task_id = response["taskUid"].as_u64().unwrap(); + index.wait_task(task_id).await; // create key with access on `products` index only. let content = json!({ @@ -312,7 +313,8 @@ async fn access_authorized_stats_no_index_restriction() { let index = server.index("products"); let (response, code) = index.create(Some("product_id")).await; assert_eq!(202, code, "{:?}", &response); - index.wait_task(0).await; + let task_id = response["taskUid"].as_u64().unwrap(); + index.wait_task(task_id).await; // create key with access on all indexes. let content = json!({ @@ -352,7 +354,8 @@ async fn list_authorized_indexes_restricted_index() { let index = server.index("products"); let (response, code) = index.create(Some("product_id")).await; assert_eq!(202, code, "{:?}", &response); - index.wait_task(0).await; + let task_id = response["taskUid"].as_u64().unwrap(); + index.wait_task(task_id).await; // create key with access on `products` index only. let content = json!({ @@ -393,7 +396,8 @@ async fn list_authorized_indexes_no_index_restriction() { let index = server.index("products"); let (response, code) = index.create(Some("product_id")).await; assert_eq!(202, code, "{:?}", &response); - index.wait_task(0).await; + let task_id = response["taskUid"].as_u64().unwrap(); + index.wait_task(task_id).await; // create key with access on all indexes. let content = json!({ @@ -433,7 +437,8 @@ async fn list_authorized_tasks_restricted_index() { let index = server.index("products"); let (response, code) = index.create(Some("product_id")).await; assert_eq!(202, code, "{:?}", &response); - index.wait_task(0).await; + let task_id = response["taskUid"].as_u64().unwrap(); + index.wait_task(task_id).await; // create key with access on `products` index only. let content = json!({ @@ -473,7 +478,8 @@ async fn list_authorized_tasks_no_index_restriction() { let index = server.index("products"); let (response, code) = index.create(Some("product_id")).await; assert_eq!(202, code, "{:?}", &response); - index.wait_task(0).await; + let task_id = response["taskUid"].as_u64().unwrap(); + index.wait_task(task_id).await; // create key with access on all indexes. let content = json!({