mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-23 13:16:27 +00:00
Test for upgrade
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use crate::common::{args::CommonArgs, client::Client, logs::setup_logs, workload::Workload};
|
||||
use crate::{
|
||||
common::{args::CommonArgs, client::Client, logs::setup_logs, workload::Workload},
|
||||
test::workload::CommandOrUpgrade,
|
||||
};
|
||||
use anyhow::{bail, Context};
|
||||
use clap::Parser;
|
||||
|
||||
@ -62,12 +65,20 @@ async fn run_inner(args: TestDeriveArgs) -> anyhow::Result<()> {
|
||||
bail!("workload file {} is not a test workload", workload_file.display());
|
||||
};
|
||||
|
||||
let has_upgrade =
|
||||
workload.commands.iter().any(|c| matches!(c, CommandOrUpgrade::Upgrade { .. }));
|
||||
|
||||
let name = workload.name.clone();
|
||||
match workload.run(&args, &assets_client, &meili_client, asset_folder).await {
|
||||
Ok(_) => match args.add_missing_responses || args.update_responses {
|
||||
Ok(_) => {
|
||||
match args.add_missing_responses || args.update_responses {
|
||||
true => println!("🛠️ Workload {name} was updated"),
|
||||
false => println!("✅ Workload {name} passed"),
|
||||
}
|
||||
if !has_upgrade {
|
||||
println!("⚠️ Warning: this workload doesn't contain an upgrade. The whole point of these tests is to test upgrades! Please add one.");
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
println!("❌ Workload {name} failed: {error}");
|
||||
println!("💡 Is this intentional? If so, rerun with --update-responses to update the workload files.");
|
||||
|
Reference in New Issue
Block a user