vdev/commands/compose_tests/
stop.rs

1use anyhow::Result;
2
3use crate::testing::{
4    config::ComposeTestConfig,
5    integration::{ComposeTest, ComposeTestLocalConfig},
6};
7
8use super::active_projects::find_active_environment_for_integration;
9
10pub(crate) fn exec(
11    local_config: ComposeTestLocalConfig,
12    test_name: &str,
13    all_features: bool,
14    reuse_image: bool,
15) -> Result<()> {
16    let (_test_dir, config) = ComposeTestConfig::load(local_config.directory, test_name)?;
17    let active_environment =
18        find_active_environment_for_integration(local_config.directory, test_name, &config)?;
19
20    if let Some(environment) = active_environment {
21        ComposeTest::generate(
22            local_config,
23            test_name,
24            environment,
25            all_features,
26            reuse_image,
27            0,
28        )?
29        .stop()
30    } else {
31        println!("No environment for {test_name} is active.");
32        Ok(())
33    }
34}