Continue integrating commands to tests

This commit is contained in:
Mubelotix
2025-08-25 12:24:21 +02:00
parent 0e25398d3e
commit 0d8b2edfb0
5 changed files with 46 additions and 42 deletions

View File

@ -8,7 +8,7 @@ use tokio::time;
use super::workload::BenchWorkload;
use crate::common::assets::Asset;
use crate::common::client::Client;
use crate::common::command::{run as run_command, Command, SyncMode};
use crate::common::command::{health_command, run as run_command};
pub async fn kill(mut meilisearch: tokio::process::Child) {
let Some(id) = meilisearch.id() else { return };
@ -123,15 +123,6 @@ async fn wait_for_health(
bail!("meilisearch is not responding")
}
fn health_command() -> Command {
Command {
route: "/health".into(),
method: crate::common::client::Method::Get,
body: Default::default(),
synchronous: SyncMode::WaitForResponse,
}
}
pub fn delete_db() {
let _ = std::fs::remove_dir_all("./_xtask_benchmark.ms");
}

View File

@ -15,7 +15,7 @@ use super::BenchDeriveArgs;
use crate::bench::meili_process;
use crate::common::assets::{self, Asset};
use crate::common::client::Client;
use crate::common::command::{run_batch as run_command_batch, Command, SyncMode};
use crate::common::command::{run_commands, Command};
/// A bench workload.
/// Not to be confused with [a test workload](crate::test::workload::Workload).
@ -32,7 +32,7 @@ pub struct BenchWorkload {
pub commands: Vec<Command>,
}
async fn run_commands(
async fn run_workload_commands(
dashboard_client: &DashboardClient,
logs_client: &Client,
meili_client: &Client,
@ -44,13 +44,8 @@ async fn run_commands(
let report_folder = &args.report_folder;
let workload_name = &workload.name;
for batch in workload
.precommands
.as_slice()
.split_inclusive(|command| !matches!(command.synchronous, SyncMode::DontWait))
{
run_command_batch(meili_client, batch, &workload.assets, &args.common.asset_folder).await?;
}
run_commands(meili_client, &workload.precommands, &workload.assets, &args.common.asset_folder)
.await?;
std::fs::create_dir_all(report_folder)
.with_context(|| format!("could not create report directory at {report_folder}"))?;
@ -60,13 +55,8 @@ async fn run_commands(
let report_handle = start_report(logs_client, trace_filename, &workload.target).await?;
for batch in workload
.commands
.as_slice()
.split_inclusive(|command| !matches!(command.synchronous, SyncMode::DontWait))
{
run_command_batch(meili_client, batch, &workload.assets, &args.common.asset_folder).await?;
}
run_commands(meili_client, &workload.commands, &workload.assets, &args.common.asset_folder)
.await?;
let processor =
stop_report(dashboard_client, logs_client, workload_uuid, report_filename, report_handle)
@ -165,7 +155,7 @@ async fn execute_run(
)
.await?;
let processor = run_commands(
let processor = run_workload_commands(
dashboard_client,
logs_client,
meili_client,