1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use std::path::PathBuf;
use anyhow::Result;
use clap::{Args, Subcommand};
#[derive(Args)]
pub struct TestArgs {
#[command(subcommand)]
pub cmd: TestCmd,
}
#[derive(Subcommand)]
pub enum TestCmd {
/// Run end-to-end baggage propagation test across all live services.
///
/// Stamps a unique test-id into W3C baggage, drives a cross-service call,
/// then queries zradar to verify the request traversed all expected services.
/// Requires all services running and zradar accessible.
E2e(E2eArgs),
}
#[derive(Args)]
pub struct E2eArgs {
/// Target environment to test against.
#[arg(long, env = "TONIN_ENV", default_value = "dev")]
pub env: String,
/// Workspace root.
#[arg(long)]
pub workspace: Option<PathBuf>,
/// zradar query endpoint (default: http://localhost:8081).
#[arg(long, default_value = "http://localhost:8081")]
pub zradar: String,
/// Entry-point service URL to drive the cross-service call through.
#[arg(long, default_value = "http://localhost:7001")]
pub entry: String,
/// How long to poll zradar for the trace before declaring failure (seconds).
#[arg(long, default_value = "30")]
pub timeout_secs: u64,
}
pub fn run(args: TestArgs) -> Result<()> {
match args.cmd {
TestCmd::E2e(e2e) => run_e2e(e2e),
}
}
fn run_e2e(args: E2eArgs) -> Result<()> {
// M4 implementation: stamp test-id baggage, drive cross-service call,
// poll zradar QueryTraces, assert traversal.
println!(
"tonin test e2e — env={} entry={} zradar={}",
args.env, args.entry, args.zradar
);
println!("Not yet implemented — wired as stub for CLI contract stability.");
println!("Implementation lands in M4 once zradar baggage converter is complete.");
Ok(())
}