From 1f67f373d1a1bc7867c6e0f7648f713711441a9b Mon Sep 17 00:00:00 2001 From: CodeMan62 Date: Thu, 20 Mar 2025 22:51:56 +0530 Subject: [PATCH] fixed all the tests failing will "cargo insta test --accept" --- crates/meilisearch/tests/search/errors.rs | 20 +++++++++---------- crates/meilisearch/tests/search/multi/mod.rs | 6 +++--- .../meilisearch/tests/search/multi/proxy.rs | 14 ++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/crates/meilisearch/tests/search/errors.rs b/crates/meilisearch/tests/search/errors.rs index f05236195..5cf42b7b4 100644 --- a/crates/meilisearch/tests/search/errors.rs +++ b/crates/meilisearch/tests/search/errors.rs @@ -884,14 +884,14 @@ async fn search_with_pattern_filter_settings_errors() { }), |response, code| { snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response), @r###" + snapshot!(json_string!(response), @r#" { "message": "Index `test`: Filter operator `=` is not allowed for the attribute `cattos`.\n - Note: allowed operators: OR, AND, NOT, <, >, <=, >=, TO, IS EMPTY, IS NULL, EXISTS.\n - Note: field `cattos` matched rule #0 in `filterableAttributes`\n - Hint: enable equality in rule #0 by modifying the features.filter object\n - Hint: prepend another rule matching `cattos` with appropriate filter features before rule #0", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" } - "###); + "#); }, ) .await; @@ -910,14 +910,14 @@ async fn search_with_pattern_filter_settings_errors() { }), |response, code| { snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response), @r###" + snapshot!(json_string!(response), @r#" { "message": "Index `test`: Filter operator `=` is not allowed for the attribute `cattos`.\n - Note: allowed operators: OR, AND, NOT, <, >, <=, >=, TO, IS EMPTY, IS NULL, EXISTS.\n - Note: field `cattos` matched rule #0 in `filterableAttributes`\n - Hint: enable equality in rule #0 by modifying the features.filter object\n - Hint: prepend another rule matching `cattos` with appropriate filter features before rule #0", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" } - "###); + "#); }, ) .await; @@ -931,14 +931,14 @@ async fn search_with_pattern_filter_settings_errors() { }), |response, code| { snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response), @r###" + snapshot!(json_string!(response), @r#" { "message": "Index `test`: Filter operator `>` is not allowed for the attribute `doggos.age`.\n - Note: allowed operators: OR, AND, NOT, =, !=, IN, IS EMPTY, IS NULL, EXISTS.\n - Note: field `doggos.age` matched rule #0 in `filterableAttributes`", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" } - "###); + "#); }, ) .await; @@ -957,14 +957,14 @@ async fn search_with_pattern_filter_settings_errors() { }), |response, code| { snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response), @r###" + snapshot!(json_string!(response), @r#" { "message": "Index `test`: Filter operator `>` is not allowed for the attribute `doggos.age`.\n - Note: allowed operators: OR, AND, NOT, =, !=, IN, IS EMPTY, IS NULL, EXISTS.\n - Note: field `doggos.age` matched rule #0 in `filterableAttributes`", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" } - "###); + "#); }, ) .await; @@ -983,14 +983,14 @@ async fn search_with_pattern_filter_settings_errors() { }), |response, code| { snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response), @r###" + snapshot!(json_string!(response), @r#" { "message": "Index `test`: Filter operator `TO` is not allowed for the attribute `doggos.age`.\n - Note: allowed operators: OR, AND, NOT, =, !=, IN, IS EMPTY, IS NULL, EXISTS.\n - Note: field `doggos.age` matched rule #0 in `filterableAttributes`", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" } - "###); + "#); }, ) .await; diff --git a/crates/meilisearch/tests/search/multi/mod.rs b/crates/meilisearch/tests/search/multi/mod.rs index 86231349e..f5dffd464 100644 --- a/crates/meilisearch/tests/search/multi/mod.rs +++ b/crates/meilisearch/tests/search/multi/mod.rs @@ -3690,14 +3690,14 @@ async fn federation_non_faceted_for_an_index() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r#" { - "message": "Inside `.federation.facetsByIndex.fruits-no-facets`: Invalid facet distribution, this index does not have configured filterable attributes.\n - Note: index `fruits-no-facets` is not used in queries", + "message": "Inside `.federation.facetsByIndex.fruits-no-facets`: Invalid facet distribution: Attributes `BOOST, id` are not filterable. This index does not have configured filterable attributes.\n - Note: index `fruits-no-facets` is not used in queries", "code": "invalid_multi_search_facets", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_facets" } - "###); + "#); // also fails let (response, code) = server diff --git a/crates/meilisearch/tests/search/multi/proxy.rs b/crates/meilisearch/tests/search/multi/proxy.rs index c78f8361a..1d6d1ad0b 100644 --- a/crates/meilisearch/tests/search/multi/proxy.rs +++ b/crates/meilisearch/tests/search/multi/proxy.rs @@ -1374,7 +1374,7 @@ async fn error_remote_does_not_answer() { "###); let (response, _status_code) = ms1.multi_search(request.clone()).await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r#" { "hits": [ { @@ -1413,15 +1413,15 @@ async fn error_remote_does_not_answer() { "offset": 0, "estimatedTotalHits": 3, "remoteErrors": { - "ms2": { - "message": "remote host did not answer before the deadline", - "code": "remote_timeout", - "type": "system", - "link": "https://docs.meilisearch.com/errors#remote_timeout" + "ms2": { + "message": "error sending request", + "code": "remote_could_not_send_request", + "type": "system", + "link": "https://docs.meilisearch.com/errors#remote_could_not_send_request" } } } - "###); + "#); } #[actix_rt::test]