From 17207b54057adae3afc4908ed164e12529616495 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Thu, 29 May 2025 09:09:02 +0300 Subject: [PATCH 1/3] tests: Faster search::matching_strategy IT tests Use shared server + unique indices for all tests Related-to: https://github.com/meilisearch/meilisearch/issues/4840 Signed-off-by: Martin Tzvetanov Grigorov --- .../meilisearch/tests/search/matching_strategy.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/meilisearch/tests/search/matching_strategy.rs b/crates/meilisearch/tests/search/matching_strategy.rs index 3b4325c10..7131ab9cc 100644 --- a/crates/meilisearch/tests/search/matching_strategy.rs +++ b/crates/meilisearch/tests/search/matching_strategy.rs @@ -2,11 +2,11 @@ use meili_snap::snapshot; use once_cell::sync::Lazy; use crate::common::index::Index; -use crate::common::{Server, Value}; +use crate::common::{Server, Shared, Value}; use crate::json; -async fn index_with_documents<'a>(server: &'a Server, documents: &Value) -> Index<'a> { - let index = server.index("test"); +async fn index_with_documents<'a>(server: &'a Server, documents: &Value) -> Index<'a> { + let index = server.unique_index(); let (task, _status_code) = index.add_documents(documents.clone(), None).await; index.wait_task(task.uid()).await.succeeded(); @@ -48,8 +48,8 @@ static SIMPLE_SEARCH_DOCUMENTS: Lazy = Lazy::new(|| { #[actix_rt::test] async fn simple_search() { - let server = Server::new().await; - let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; + let server = Server::new_shared(); + let index = index_with_documents(server, &SIMPLE_SEARCH_DOCUMENTS).await; index .search(json!({"q": "Captain Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| { @@ -75,7 +75,7 @@ async fn simple_search() { #[actix_rt::test] async fn search_with_typo() { - let server = Server::new().await; + let server = Server::new_shared(); let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; index @@ -102,7 +102,7 @@ async fn search_with_typo() { #[actix_rt::test] async fn search_with_unknown_word() { - let server = Server::new().await; + let server = Server::new_shared(); let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; index From fb8b8321922e40b2cc647bfe71e813cc0c8a40f6 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Thu, 29 May 2025 10:54:31 +0300 Subject: [PATCH 2/3] Trigger build Signed-off-by: Martin Tzvetanov Grigorov From 308fd7128e60907b7ce30364993fb6165ad622c0 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Thu, 29 May 2025 11:36:56 +0300 Subject: [PATCH 3/3] Fix clippy errors Signed-off-by: Martin Tzvetanov Grigorov --- crates/meilisearch/tests/search/matching_strategy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/meilisearch/tests/search/matching_strategy.rs b/crates/meilisearch/tests/search/matching_strategy.rs index 7131ab9cc..ece320b2a 100644 --- a/crates/meilisearch/tests/search/matching_strategy.rs +++ b/crates/meilisearch/tests/search/matching_strategy.rs @@ -76,7 +76,7 @@ async fn simple_search() { #[actix_rt::test] async fn search_with_typo() { let server = Server::new_shared(); - let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; + let index = index_with_documents(server, &SIMPLE_SEARCH_DOCUMENTS).await; index .search(json!({"q": "Capitain Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| { @@ -103,7 +103,7 @@ async fn search_with_typo() { #[actix_rt::test] async fn search_with_unknown_word() { let server = Server::new_shared(); - let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; + let index = index_with_documents(server, &SIMPLE_SEARCH_DOCUMENTS).await; index .search(json!({"q": "Captain Supercopter Marvel", "matchingStrategy": "last", "attributesToRetrieve": ["id"]}), |response, code| {