vdev/commands/
test_vrl.rs

1use anyhow::{Context as _, Result};
2
3use crate::app;
4use std::{env, path::PathBuf};
5
6/// Run the Vector Remap Language test suite
7#[derive(clap::Args, Debug)]
8#[command()]
9pub struct Cli {}
10
11impl Cli {
12    pub fn exec(self) -> Result<()> {
13        run_tests(&[app::path(), "lib", "vector-vrl", "tests"])?;
14        Ok(())
15    }
16}
17
18fn run_tests(path: &[&str]) -> Result<()> {
19    let path: PathBuf = path.iter().collect();
20    env::set_current_dir(path).context("Could not change directory")?;
21    app::exec("cargo", ["run"], false)
22}