mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-24 05:36:28 +00:00
Continue integrating commands to tests
This commit is contained in:
@ -15,7 +15,7 @@ pub struct Command {
|
||||
#[serde(default)]
|
||||
pub body: Body,
|
||||
#[serde(default)]
|
||||
pub synchronous: SyncMode,
|
||||
synchronous: SyncMode,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Deserialize)]
|
||||
@ -64,14 +64,14 @@ impl Display for Command {
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Copy, Deserialize)]
|
||||
pub enum SyncMode {
|
||||
enum SyncMode {
|
||||
DontWait,
|
||||
#[default]
|
||||
WaitForResponse,
|
||||
WaitForTask,
|
||||
}
|
||||
|
||||
pub async fn run_batch(
|
||||
async fn run_batch(
|
||||
client: &Client,
|
||||
batch: &[Command],
|
||||
assets: &BTreeMap<String, Asset>,
|
||||
@ -192,3 +192,27 @@ pub async fn run(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn run_commands(
|
||||
client: &Client,
|
||||
commands: &[Command],
|
||||
assets: &BTreeMap<String, Asset>,
|
||||
asset_folder: &str,
|
||||
) -> anyhow::Result<()> {
|
||||
for batch in
|
||||
commands.split_inclusive(|command| !matches!(command.synchronous, SyncMode::DontWait))
|
||||
{
|
||||
run_batch(client, batch, assets, asset_folder).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn health_command() -> Command {
|
||||
Command {
|
||||
route: "/health".into(),
|
||||
method: crate::common::client::Method::Get,
|
||||
body: Default::default(),
|
||||
synchronous: SyncMode::WaitForResponse,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user