1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use anyhow::Result;

use crate::testing::{config::ComposeTestConfig, integration::ComposeTestT};

pub(crate) fn exec<T: ComposeTestT>(
    integration: &str,
    environment: &Option<String>,
    build_all: bool,
) -> Result<()> {
    let environment = if let Some(environment) = environment {
        environment.clone()
    } else {
        let (_test_dir, config) = ComposeTestConfig::load(T::DIRECTORY, integration)?;
        let envs = config.environments();
        let env = envs.keys().next().expect("Integration has no environments");
        env.clone()
    };

    T::start(&T::generate(integration, environment, build_all, 0)?)
}