change the details of the tasks

This commit is contained in:
Tamo
2025-08-11 18:28:00 +02:00
parent a904ce109a
commit 4068c58417
102 changed files with 300 additions and 320 deletions

View File

@ -288,7 +288,6 @@ fn deny_immutable_fields_index(
location: ValuePointerRef,
) -> DeserrJsonError {
match field {
"uid" => immutable_field_error(field, accepted, Code::ImmutableIndexUid),
"createdAt" => immutable_field_error(field, accepted, Code::ImmutableIndexCreatedAt),
"updatedAt" => immutable_field_error(field, accepted, Code::ImmutableIndexUpdatedAt),
_ => deserr::take_cf_content(DeserrJsonError::<BadRequest>::error::<Infallible>(

View File

@ -160,36 +160,20 @@ async fn update_index_bad_primary_key() {
"###);
}
#[actix_rt::test]
async fn update_index_immutable_uid() {
let server = Server::new_shared();
let index = server.unique_index();
let (response, code) = index.update_raw(json!({ "uid": "doggo" })).await;
snapshot!(code, @"400 Bad Request");
snapshot!(json_string!(response), @r###"
{
"message": "Immutable field `uid`: expected one of `primaryKey`",
"code": "immutable_index_uid",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#immutable_index_uid"
}
"###);
}
#[actix_rt::test]
async fn update_index_immutable_created_at() {
let server = Server::new_shared();
let index = server.unique_index();
let (response, code) = index.update_raw(json!({ "createdAt": "doggo" })).await;
snapshot!(code, @"400 Bad Request");
snapshot!(json_string!(response), @r###"
snapshot!(json_string!(response), @r#"
{
"message": "Immutable field `createdAt`: expected one of `primaryKey`",
"message": "Immutable field `createdAt`: expected one of `primaryKey`, `uid`",
"code": "immutable_index_created_at",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#immutable_index_created_at"
}
"###);
"#);
}
#[actix_rt::test]
@ -198,14 +182,14 @@ async fn update_index_immutable_updated_at() {
let index = server.unique_index();
let (response, code) = index.update_raw(json!({ "updatedAt": "doggo" })).await;
snapshot!(code, @"400 Bad Request");
snapshot!(json_string!(response), @r###"
snapshot!(json_string!(response), @r#"
{
"message": "Immutable field `updatedAt`: expected one of `primaryKey`",
"message": "Immutable field `updatedAt`: expected one of `primaryKey`, `uid`",
"code": "immutable_index_updated_at",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#immutable_index_updated_at"
}
"###);
"#);
}
#[actix_rt::test]
@ -214,14 +198,14 @@ async fn update_index_unknown_field() {
let index = server.unique_index();
let (response, code) = index.update_raw(json!({ "doggo": "bork" })).await;
snapshot!(code, @"400 Bad Request");
snapshot!(json_string!(response), @r###"
snapshot!(json_string!(response), @r#"
{
"message": "Unknown field `doggo`: expected one of `primaryKey`",
"message": "Unknown field `doggo`: expected one of `primaryKey`, `uid`",
"code": "bad_request",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#bad_request"
}
"###);
"#);
}
#[actix_rt::test]

View File

@ -139,6 +139,25 @@ async fn update_index_name() {
snapshot!(response.as_object().unwrap().len(), @"4");
}
#[actix_rt::test]
async fn update_index_name_to_itself() {
let server = Server::new_shared();
let index = server.unique_index();
let (task, _code) = index.create(None).await;
server.wait_task(task.uid()).await.succeeded();
let (initial_response, code) = index.get().await;
snapshot!(code, @"200 OK");
let (task, _code) = index.update_raw(json!({ "uid": index.uid })).await;
server.wait_task(task.uid()).await.succeeded();
let (new_response, code) = index.get().await;
snapshot!(code, @"200 OK");
// Renaming an index to its own name should not change anything
assert_eq!(initial_response, new_response);
}
#[actix_rt::test]
async fn error_update_index_name_to_already_existing_index() {
let server = Server::new_shared();