Merge pull request #5599 from martin-g/faster-index-search-errors-tests

tests: Faster search::errors IT tests
This commit is contained in:
Many the fish 2025-06-02 06:54:32 +00:00 committed by GitHub
commit 86ff502327
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1196,10 +1196,8 @@ async fn search_on_unknown_field_plus_joker() {
#[actix_rt::test] #[actix_rt::test]
async fn distinct_at_search_time() { async fn distinct_at_search_time() {
let server = Server::new().await; let server = Server::new_shared();
let index = server.index("test"); let index = server.unique_index();
let (task, _) = index.create(None).await;
index.wait_task(task.uid()).await.succeeded();
let (response, _code) = let (response, _code) =
index.add_documents(json!([{"id": 1, "color": "Doggo", "machin": "Action"}]), None).await; index.add_documents(json!([{"id": 1, "color": "Doggo", "machin": "Action"}]), None).await;
index.wait_task(response.uid()).await.succeeded(); index.wait_task(response.uid()).await.succeeded();
@ -1209,7 +1207,7 @@ async fn distinct_at_search_time() {
snapshot!(code, @"400 Bad Request"); snapshot!(code, @"400 Bad Request");
snapshot!(response, @r###" snapshot!(response, @r###"
{ {
"message": "Index `test`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. This index does not have configured filterable attributes.", "message": "Index `[uuid]`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. This index does not have configured filterable attributes.",
"code": "invalid_search_distinct", "code": "invalid_search_distinct",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_search_distinct" "link": "https://docs.meilisearch.com/errors#invalid_search_distinct"
@ -1224,7 +1222,7 @@ async fn distinct_at_search_time() {
snapshot!(code, @"400 Bad Request"); snapshot!(code, @"400 Bad Request");
snapshot!(response, @r###" snapshot!(response, @r###"
{ {
"message": "Index `test`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. Available filterable attributes patterns are: `color, machin`.", "message": "Index `[uuid]`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. Available filterable attributes patterns are: `color, machin`.",
"code": "invalid_search_distinct", "code": "invalid_search_distinct",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_search_distinct" "link": "https://docs.meilisearch.com/errors#invalid_search_distinct"
@ -1239,7 +1237,7 @@ async fn distinct_at_search_time() {
snapshot!(code, @"400 Bad Request"); snapshot!(code, @"400 Bad Request");
snapshot!(response, @r###" snapshot!(response, @r###"
{ {
"message": "Index `test`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. Available filterable attributes patterns are: `color, <..hidden-attributes>`.", "message": "Index `[uuid]`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. Available filterable attributes patterns are: `color, <..hidden-attributes>`.",
"code": "invalid_search_distinct", "code": "invalid_search_distinct",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_search_distinct" "link": "https://docs.meilisearch.com/errors#invalid_search_distinct"