mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 12:46:31 +00:00
update the task details again
This commit is contained in:
@ -319,6 +319,24 @@ impl Index<'_, Shared> {
|
||||
}
|
||||
(task, code)
|
||||
}
|
||||
|
||||
pub async fn update_raw_index_fail<State>(
|
||||
&self,
|
||||
body: Value,
|
||||
waiter: &Server<State>,
|
||||
) -> (Value, StatusCode) {
|
||||
let (mut task, code) = self._update_raw(body).await;
|
||||
if code.is_success() {
|
||||
task = waiter.wait_task(task.uid()).await;
|
||||
if task.is_success() {
|
||||
panic!(
|
||||
"`update_raw_index_fail` succeeded: {}",
|
||||
serde_json::to_string_pretty(&task).unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
(task, code)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@ -370,6 +388,11 @@ impl<State> Index<'_, State> {
|
||||
self.service.patch_encoded(url, body, self.encoder).await
|
||||
}
|
||||
|
||||
pub(super) async fn _update_raw(&self, body: Value) -> (Value, StatusCode) {
|
||||
let url = format!("/indexes/{}", urlencode(self.uid.as_ref()));
|
||||
self.service.patch_encoded(url, body, self.encoder).await
|
||||
}
|
||||
|
||||
pub(super) async fn _delete(&self) -> (Value, StatusCode) {
|
||||
let url = format!("/indexes/{}", urlencode(self.uid.as_ref()));
|
||||
self.service.delete(url).await
|
||||
|
@ -162,22 +162,21 @@ async fn update_index_name_to_itself() {
|
||||
async fn error_update_index_name_to_already_existing_index() {
|
||||
let server = Server::new_shared();
|
||||
let base_index = shared_empty_index().await;
|
||||
let index = server.unique_index();
|
||||
let (task, _code) = index.create(None).await;
|
||||
server.wait_task(task.uid()).await.succeeded();
|
||||
let index = shared_index_with_documents().await;
|
||||
|
||||
let (task, _status_code) = index.update_raw(json!({ "uid": base_index.uid })).await;
|
||||
let task = server.wait_task(task.uid()).await;
|
||||
let (task, _status_code) =
|
||||
index.update_raw_index_fail(json!({ "uid": base_index.uid }), server).await;
|
||||
snapshot!(task, @r#"
|
||||
{
|
||||
"uid": "[uid]",
|
||||
"batchUid": "[batch_uid]",
|
||||
"indexUid": "[uuid]",
|
||||
"indexUid": "SHARED_DOCUMENTS",
|
||||
"status": "failed",
|
||||
"type": "indexUpdate",
|
||||
"canceledBy": null,
|
||||
"details": {
|
||||
"primaryKey": null,
|
||||
"oldIndexUid": "SHARED_DOCUMENTS",
|
||||
"newIndexUid": "EMPTY_INDEX"
|
||||
},
|
||||
"error": {
|
||||
|
Reference in New Issue
Block a user