Create test workload

This commit is contained in:
Mubelotix
2025-08-25 11:43:11 +02:00
parent 78e98a4e6c
commit 8240b76267
10 changed files with 28 additions and 12 deletions

View File

@ -5,8 +5,8 @@ use std::io::Read as _;
use anyhow::{bail, Context as _}; use anyhow::{bail, Context as _};
use serde::Deserialize; use serde::Deserialize;
use super::assets::{fetch_asset, Asset}; use crate::common::assets::{fetch_asset, Asset};
use super::client::{Client, Method}; use crate::common::client::{Client, Method};
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]
pub struct Command { pub struct Command {

View File

@ -7,9 +7,9 @@ use tokio::task::AbortHandle;
use tracing_trace::processor::span_stats::CallStats; use tracing_trace::processor::span_stats::CallStats;
use uuid::Uuid; use uuid::Uuid;
use super::client::Client;
use super::env_info; use super::env_info;
use super::workload::Workload; use super::workload::Workload;
use crate::common::client::Client;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum DashboardClient { pub enum DashboardClient {

View File

@ -5,9 +5,9 @@ use anyhow::{bail, Context as _};
use tokio::process::Command; use tokio::process::Command;
use tokio::time; use tokio::time;
use super::assets::Asset;
use super::client::Client;
use super::workload::Workload; use super::workload::Workload;
use crate::common::assets::Asset;
use crate::common::client::Client;
pub async fn kill(mut meilisearch: tokio::process::Child) { pub async fn kill(mut meilisearch: tokio::process::Child) {
let Some(id) = meilisearch.id() else { return }; let Some(id) = meilisearch.id() else { return };
@ -125,7 +125,7 @@ async fn wait_for_health(
fn health_command() -> super::command::Command { fn health_command() -> super::command::Command {
super::command::Command { super::command::Command {
route: "/health".into(), route: "/health".into(),
method: super::client::Method::Get, method: crate::common::client::Method::Get,
body: Default::default(), body: Default::default(),
synchronous: super::command::SyncMode::WaitForResponse, synchronous: super::command::SyncMode::WaitForResponse,
} }

View File

@ -1,5 +1,3 @@
mod assets;
mod client;
mod command; mod command;
mod dashboard; mod dashboard;
mod env_info; mod env_info;
@ -13,8 +11,8 @@ use std::path::PathBuf;
use anyhow::Context; use anyhow::Context;
use clap::Parser; use clap::Parser;
use self::client::Client;
use self::workload::Workload; use self::workload::Workload;
use crate::common::client::Client;
pub fn default_http_addr() -> String { pub fn default_http_addr() -> String {
"127.0.0.1:7700".to_string() "127.0.0.1:7700".to_string()

View File

@ -10,13 +10,15 @@ use serde_json::json;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use uuid::Uuid; use uuid::Uuid;
use super::assets::Asset;
use super::client::Client;
use super::command::SyncMode; use super::command::SyncMode;
use super::dashboard::DashboardClient; use super::dashboard::DashboardClient;
use super::BenchDeriveArgs; use super::BenchDeriveArgs;
use crate::bench::{assets, meili_process}; use crate::bench::meili_process;
use crate::common::assets::{self, Asset};
use crate::common::client::Client;
/// A bench workload.
/// Not to be confused with [a test workload](crate::test::workload::Workload).
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct Workload { pub struct Workload {
pub name: String, pub name: String,

View File

@ -1,2 +1,4 @@
pub mod args; pub mod args;
pub mod assets;
pub mod client;
pub mod logs; pub mod logs;

View File

@ -2,6 +2,8 @@ use clap::Parser;
use crate::common::{args::CommonArgs, logs::setup_logs}; use crate::common::{args::CommonArgs, logs::setup_logs};
mod workload;
/// Run tests from a workload /// Run tests from a workload
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
pub struct TestDeriveArgs { pub struct TestDeriveArgs {

View File

@ -0,0 +1,12 @@
use std::collections::BTreeMap;
use serde::Deserialize;
use crate::common::assets::Asset;
/// A test workload.
/// Not to be confused with [a bench workload](crate::bench::workload::Workload).
#[derive(Deserialize)]
pub struct Workload {
pub name: String,
pub assets: BTreeMap<String, Asset>,
}