From 484dbf8c064570a2abb5d0d59f39936cbbfdbf16 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 29 Jul 2025 15:31:29 +0200 Subject: [PATCH] Update snap --- crates/meilisearch/tests/network/mod.rs | 199 +++++++++++------- .../meilisearch/tests/search/multi/proxy.rs | 81 ++++--- 2 files changed, 172 insertions(+), 108 deletions(-) diff --git a/crates/meilisearch/tests/network/mod.rs b/crates/meilisearch/tests/network/mod.rs index 60f73ed40..e25656eb0 100644 --- a/crates/meilisearch/tests/network/mod.rs +++ b/crates/meilisearch/tests/network/mod.rs @@ -46,7 +46,7 @@ async fn errors_on_param() { meili_snap::snapshot!(code, @"400 Bad Request"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" { - "message": "Unknown field `selfie`: expected one of `remotes`, `self`", + "message": "Unknown field `selfie`: expected one of `remotes`, `self`, `sharding`", "code": "bad_request", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#bad_request" @@ -149,7 +149,7 @@ async fn errors_on_param() { meili_snap::snapshot!(code, @"400 Bad Request"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" { - "message": "Unknown field `doggo` inside `.remotes.new`: expected one of `url`, `searchApiKey`", + "message": "Unknown field `doggo` inside `.remotes.new`: expected one of `url`, `searchApiKey`, `writeApiKey`", "code": "invalid_network_remotes", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_network_remotes" @@ -192,9 +192,11 @@ async fn errors_on_param() { "remotes": { "kefir": { "url": "http://localhost:7700", - "searchApiKey": null + "searchApiKey": null, + "writeApiKey": null } - } + }, + "sharding": false } "###); let (response, code) = server @@ -266,7 +268,8 @@ async fn auth() { meili_snap::snapshot!(meili_snap::json_string!(response), @r###" { "self": "master", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -274,11 +277,12 @@ async fn auth() { meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" -{ - "self": "master", - "remotes": {} -} -"###); + { + "self": "master", + "remotes": {}, + "sharding": false + } + "###); // try get with get permission server.use_api_key(get_network_key.as_str().unwrap()); @@ -286,11 +290,12 @@ async fn auth() { meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" -{ - "self": "master", - "remotes": {} -} -"###); + { + "self": "master", + "remotes": {}, + "sharding": false + } + "###); // try update with update permission server.use_api_key(update_network_key.as_str().unwrap()); @@ -303,11 +308,12 @@ async fn auth() { meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" -{ - "self": "api_key", - "remotes": {} -} -"###); + { + "self": "api_key", + "remotes": {}, + "sharding": false + } + "###); // try with the other's permission let (response, code) = server.get_network().await; @@ -383,7 +389,8 @@ async fn get_and_set_network() { meili_snap::snapshot!(meili_snap::json_string!(response), @r###" { "self": null, - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -393,7 +400,8 @@ async fn get_and_set_network() { meili_snap::snapshot!(meili_snap::json_string!(response), @r###" { "self": "myself", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -417,13 +425,16 @@ async fn get_and_set_network() { "remotes": { "myself": { "url": "http://localhost:7700", - "searchApiKey": null + "searchApiKey": null, + "writeApiKey": null }, "thy": { "url": "http://localhost:7701", - "searchApiKey": "foo" + "searchApiKey": "foo", + "writeApiKey": null } - } + }, + "sharding": false } "###); @@ -443,13 +454,16 @@ async fn get_and_set_network() { "remotes": { "myself": { "url": "http://localhost:7700", - "searchApiKey": null + "searchApiKey": null, + "writeApiKey": null }, "thy": { "url": "http://localhost:7701", - "searchApiKey": "bar" + "searchApiKey": "bar", + "writeApiKey": null } - } + }, + "sharding": false } "###); @@ -470,17 +484,21 @@ async fn get_and_set_network() { "remotes": { "myself": { "url": "http://localhost:7700", - "searchApiKey": null + "searchApiKey": null, + "writeApiKey": null }, "them": { "url": "http://localhost:7702", - "searchApiKey": "baz" + "searchApiKey": "baz", + "writeApiKey": null }, "thy": { "url": "http://localhost:7701", - "searchApiKey": "bar" + "searchApiKey": "bar", + "writeApiKey": null } - } + }, + "sharding": false } "###); @@ -498,13 +516,16 @@ async fn get_and_set_network() { "remotes": { "them": { "url": "http://localhost:7702", - "searchApiKey": "baz" + "searchApiKey": "baz", + "writeApiKey": null }, "thy": { "url": "http://localhost:7701", - "searchApiKey": "bar" + "searchApiKey": "bar", + "writeApiKey": null } - } + }, + "sharding": false } "###); @@ -518,13 +539,16 @@ async fn get_and_set_network() { "remotes": { "them": { "url": "http://localhost:7702", - "searchApiKey": "baz" + "searchApiKey": "baz", + "writeApiKey": null }, "thy": { "url": "http://localhost:7701", - "searchApiKey": "bar" + "searchApiKey": "bar", + "writeApiKey": null } - } + }, + "sharding": false } "###); @@ -538,13 +562,16 @@ async fn get_and_set_network() { "remotes": { "them": { "url": "http://localhost:7702", - "searchApiKey": "baz" + "searchApiKey": "baz", + "writeApiKey": null }, "thy": { "url": "http://localhost:7701", - "searchApiKey": "bar" + "searchApiKey": "bar", + "writeApiKey": null } - } + }, + "sharding": false } "###); @@ -553,60 +580,69 @@ async fn get_and_set_network() { meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" - { - "self": "thy", - "remotes": { - "them": { - "url": "http://localhost:7702", - "searchApiKey": "baz" - }, - "thy": { - "url": "http://localhost:7701", - "searchApiKey": "bar" - } - } + { + "self": "thy", + "remotes": { + "them": { + "url": "http://localhost:7702", + "searchApiKey": "baz", + "writeApiKey": null + }, + "thy": { + "url": "http://localhost:7701", + "searchApiKey": "bar", + "writeApiKey": null } - "###); + }, + "sharding": false + } + "###); // still doing nothing let (response, code) = server.set_network(json!({"remotes": {}})).await; meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" - { - "self": "thy", - "remotes": { - "them": { - "url": "http://localhost:7702", - "searchApiKey": "baz" - }, - "thy": { - "url": "http://localhost:7701", - "searchApiKey": "bar" - } - } + { + "self": "thy", + "remotes": { + "them": { + "url": "http://localhost:7702", + "searchApiKey": "baz", + "writeApiKey": null + }, + "thy": { + "url": "http://localhost:7701", + "searchApiKey": "bar", + "writeApiKey": null } - "###); + }, + "sharding": false + } + "###); // good time to check GET let (response, code) = server.get_network().await; meili_snap::snapshot!(code, @"200 OK"); meili_snap::snapshot!(meili_snap::json_string!(response), @r###" - { - "self": "thy", - "remotes": { - "them": { - "url": "http://localhost:7702", - "searchApiKey": "baz" - }, - "thy": { - "url": "http://localhost:7701", - "searchApiKey": "bar" - } - } + { + "self": "thy", + "remotes": { + "them": { + "url": "http://localhost:7702", + "searchApiKey": "baz", + "writeApiKey": null + }, + "thy": { + "url": "http://localhost:7701", + "searchApiKey": "bar", + "writeApiKey": null } - "###); + }, + "sharding": false + } + "###); // deleting everything let (response, code) = server @@ -619,7 +655,8 @@ async fn get_and_set_network() { meili_snap::snapshot!(meili_snap::json_string!(response), @r###" { "self": "thy", - "remotes": {} + "remotes": {}, + "sharding": false } "###); } diff --git a/crates/meilisearch/tests/search/multi/proxy.rs b/crates/meilisearch/tests/search/multi/proxy.rs index 2b1623ff8..ac997f859 100644 --- a/crates/meilisearch/tests/search/multi/proxy.rs +++ b/crates/meilisearch/tests/search/multi/proxy.rs @@ -132,7 +132,8 @@ async fn remote_sharding() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -140,7 +141,8 @@ async fn remote_sharding() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms2.set_network(json!({"self": "ms2"})).await; @@ -148,7 +150,8 @@ async fn remote_sharding() { snapshot!(json_string!(response), @r###" { "self": "ms2", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -934,7 +937,8 @@ async fn error_unregistered_remote() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -942,7 +946,8 @@ async fn error_unregistered_remote() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1052,7 +1057,8 @@ async fn error_no_weighted_score() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1060,7 +1066,8 @@ async fn error_no_weighted_score() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1185,7 +1192,8 @@ async fn error_bad_response() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1193,7 +1201,8 @@ async fn error_bad_response() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1322,7 +1331,8 @@ async fn error_bad_request() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1330,7 +1340,8 @@ async fn error_bad_request() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1452,7 +1463,8 @@ async fn error_bad_request_facets_by_index() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1460,7 +1472,8 @@ async fn error_bad_request_facets_by_index() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1593,7 +1606,8 @@ async fn error_bad_request_facets_by_index_facet() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1601,7 +1615,8 @@ async fn error_bad_request_facets_by_index_facet() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1743,7 +1758,8 @@ async fn error_remote_does_not_answer() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1751,7 +1767,8 @@ async fn error_remote_does_not_answer() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -1944,7 +1961,8 @@ async fn error_remote_404() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -1952,7 +1970,8 @@ async fn error_remote_404() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -2139,7 +2158,8 @@ async fn error_remote_sharding_auth() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -2147,7 +2167,8 @@ async fn error_remote_sharding_auth() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -2299,7 +2320,8 @@ async fn remote_sharding_auth() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -2307,7 +2329,8 @@ async fn remote_sharding_auth() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -2454,7 +2477,8 @@ async fn error_remote_500() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -2462,7 +2486,8 @@ async fn error_remote_500() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###); @@ -2633,7 +2658,8 @@ async fn error_remote_500_once() { snapshot!(json_string!(response), @r###" { "self": "ms0", - "remotes": {} + "remotes": {}, + "sharding": false } "###); let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; @@ -2641,7 +2667,8 @@ async fn error_remote_500_once() { snapshot!(json_string!(response), @r###" { "self": "ms1", - "remotes": {} + "remotes": {}, + "sharding": false } "###);