Update snap

This commit is contained in:
Louis Dureuil
2025-07-29 15:31:29 +02:00
parent 9c6c0af076
commit 484dbf8c06
2 changed files with 172 additions and 108 deletions

View File

@ -46,7 +46,7 @@ async fn errors_on_param() {
meili_snap::snapshot!(code, @"400 Bad Request"); meili_snap::snapshot!(code, @"400 Bad Request");
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" 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", "code": "bad_request",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#bad_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!(code, @"400 Bad Request");
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" 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", "code": "invalid_network_remotes",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_network_remotes" "link": "https://docs.meilisearch.com/errors#invalid_network_remotes"
@ -192,9 +192,11 @@ async fn errors_on_param() {
"remotes": { "remotes": {
"kefir": { "kefir": {
"url": "http://localhost:7700", "url": "http://localhost:7700",
"searchApiKey": null "searchApiKey": null,
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
let (response, code) = server let (response, code) = server
@ -266,7 +268,8 @@ async fn auth() {
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": "master", "self": "master",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -276,7 +279,8 @@ async fn auth() {
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": "master", "self": "master",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -288,7 +292,8 @@ async fn auth() {
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": "master", "self": "master",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -305,7 +310,8 @@ async fn auth() {
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": "api_key", "self": "api_key",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -383,7 +389,8 @@ async fn get_and_set_network() {
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": null, "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###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": "myself", "self": "myself",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -417,13 +425,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"myself": { "myself": {
"url": "http://localhost:7700", "url": "http://localhost:7700",
"searchApiKey": null "searchApiKey": null,
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "foo" "searchApiKey": "foo",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -443,13 +454,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"myself": { "myself": {
"url": "http://localhost:7700", "url": "http://localhost:7700",
"searchApiKey": null "searchApiKey": null,
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -470,17 +484,21 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"myself": { "myself": {
"url": "http://localhost:7700", "url": "http://localhost:7700",
"searchApiKey": null "searchApiKey": null,
"writeApiKey": null
}, },
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -498,13 +516,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -518,13 +539,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -538,13 +562,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -558,13 +585,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -578,13 +608,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -598,13 +631,16 @@ async fn get_and_set_network() {
"remotes": { "remotes": {
"them": { "them": {
"url": "http://localhost:7702", "url": "http://localhost:7702",
"searchApiKey": "baz" "searchApiKey": "baz",
"writeApiKey": null
}, },
"thy": { "thy": {
"url": "http://localhost:7701", "url": "http://localhost:7701",
"searchApiKey": "bar" "searchApiKey": "bar",
} "writeApiKey": null
} }
},
"sharding": false
} }
"###); "###);
@ -619,7 +655,8 @@ async fn get_and_set_network() {
meili_snap::snapshot!(meili_snap::json_string!(response), @r###" meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{ {
"self": "thy", "self": "thy",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
} }

View File

@ -132,7 +132,8 @@ async fn remote_sharding() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -140,7 +141,8 @@ async fn remote_sharding() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms2.set_network(json!({"self": "ms2"})).await; let (response, code) = ms2.set_network(json!({"self": "ms2"})).await;
@ -148,7 +150,8 @@ async fn remote_sharding() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms2", "self": "ms2",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -934,7 +937,8 @@ async fn error_unregistered_remote() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -942,7 +946,8 @@ async fn error_unregistered_remote() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1052,7 +1057,8 @@ async fn error_no_weighted_score() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; 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###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1185,7 +1192,8 @@ async fn error_bad_response() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -1193,7 +1201,8 @@ async fn error_bad_response() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1322,7 +1331,8 @@ async fn error_bad_request() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -1330,7 +1340,8 @@ async fn error_bad_request() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1452,7 +1463,8 @@ async fn error_bad_request_facets_by_index() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; 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###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1593,7 +1606,8 @@ async fn error_bad_request_facets_by_index_facet() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; 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###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1743,7 +1758,8 @@ async fn error_remote_does_not_answer() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; 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###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -1944,7 +1961,8 @@ async fn error_remote_404() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -1952,7 +1970,8 @@ async fn error_remote_404() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -2139,7 +2158,8 @@ async fn error_remote_sharding_auth() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; 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###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -2299,7 +2320,8 @@ async fn remote_sharding_auth() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -2307,7 +2329,8 @@ async fn remote_sharding_auth() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -2454,7 +2477,8 @@ async fn error_remote_500() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; let (response, code) = ms1.set_network(json!({"self": "ms1"})).await;
@ -2462,7 +2486,8 @@ async fn error_remote_500() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
@ -2633,7 +2658,8 @@ async fn error_remote_500_once() {
snapshot!(json_string!(response), @r###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms0", "self": "ms0",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);
let (response, code) = ms1.set_network(json!({"self": "ms1"})).await; 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###" snapshot!(json_string!(response), @r###"
{ {
"self": "ms1", "self": "ms1",
"remotes": {} "remotes": {},
"sharding": false
} }
"###); "###);