mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-10 21:44:34 +01:00
try to fix the snapshot on demand flaky test
This commit is contained in:
parent
95975944d7
commit
214b51de87
@ -52,6 +52,25 @@ impl Value {
|
|||||||
}
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return `true` if the `status` field is set to `failed`.
|
||||||
|
/// Panic if the `status` field doesn't exists.
|
||||||
|
#[track_caller]
|
||||||
|
pub fn is_fail(&self) -> bool {
|
||||||
|
if !self["status"].is_string() {
|
||||||
|
panic!("Called `is_fail` on {}", serde_json::to_string_pretty(&self.0).unwrap());
|
||||||
|
}
|
||||||
|
self["status"] == serde_json::Value::String(String::from("failed"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Panic if the json doesn't contain the `status` field set to "succeeded"
|
||||||
|
#[track_caller]
|
||||||
|
pub fn failed(&self) -> &Self {
|
||||||
|
if !self.is_fail() {
|
||||||
|
panic!("Called failed on {}", serde_json::to_string_pretty(&self.0).unwrap());
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<serde_json::Value> for Value {
|
impl From<serde_json::Value> for Value {
|
||||||
|
@ -129,11 +129,11 @@ async fn perform_on_demand_snapshot() {
|
|||||||
|
|
||||||
index.load_test_set().await;
|
index.load_test_set().await;
|
||||||
|
|
||||||
server.index("doggo").create(Some("bone")).await;
|
let (task, _) = server.index("doggo").create(Some("bone")).await;
|
||||||
index.wait_task(2).await;
|
index.wait_task(task.uid()).await.succeeded();
|
||||||
|
|
||||||
server.index("doggo").create(Some("bone")).await;
|
let (task, _) = server.index("doggo").create(Some("bone")).await;
|
||||||
index.wait_task(2).await;
|
index.wait_task(task.uid()).await.failed();
|
||||||
|
|
||||||
let (task, code) = server.create_snapshot().await;
|
let (task, code) = server.create_snapshot().await;
|
||||||
snapshot!(code, @"202 Accepted");
|
snapshot!(code, @"202 Accepted");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user