fix error code and add a bunch of tests for the swap and index rename

This commit is contained in:
Tamo
2025-08-11 17:37:30 +02:00
parent f367a35f2d
commit 2d243d6109
7 changed files with 182 additions and 39 deletions

View File

@ -895,7 +895,7 @@ async fn test_summarized_index_swap() {
server.wait_task(task.uid()).await.failed();
let (task, _) = server.get_task(task.uid()).await;
snapshot!(task,
@r###"
@r#"
{
"uid": "[uid]",
"batchUid": "[batch_uid]",
@ -909,7 +909,8 @@ async fn test_summarized_index_swap() {
"indexes": [
"doggos",
"cattos"
]
],
"rename": false
}
]
},
@ -924,7 +925,7 @@ async fn test_summarized_index_swap() {
"startedAt": "[date]",
"finishedAt": "[date]"
}
"###);
"#);
let doggos_index = server.unique_index();
let (task, _code) = doggos_index.create(None).await;
@ -941,7 +942,7 @@ async fn test_summarized_index_swap() {
let (task, _) = server.get_task(task.uid()).await;
snapshot!(json_string!(task,
{ ".uid" => "[uid]", ".batchUid" => "[batch_uid]", ".**.indexes[0]" => "doggos", ".**.indexes[1]" => "cattos", ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
@r###"
@r#"
{
"uid": "[uid]",
"batchUid": "[batch_uid]",
@ -955,7 +956,8 @@ async fn test_summarized_index_swap() {
"indexes": [
"doggos",
"cattos"
]
],
"rename": false
}
]
},
@ -965,7 +967,7 @@ async fn test_summarized_index_swap() {
"startedAt": "[date]",
"finishedAt": "[date]"
}
"###);
"#);
}
#[actix_web::test]