vectordotdev/vector · error

No environments found for test

Error message

No environments found for test '{test_name}'

What it means

This error is thrown by `cargo vdev compose_tests run` (exec) when, after resolving which integration-test environments to use, the resulting set is empty. Vector's integration tests run per-environment (e.g. docker compose profiles per cloud), so running with zero environments is meaningless and is rejected up front with anyhow::bail!.

Solutions

  1. Add the environments to run via the command's environment flag (e.g. pass environment names explicitly).
  2. Check the vdev local config (config.environments()) and populate it with the environments you want.
  3. Verify the test name is correct; a test with no registered environments cannot run.
  4. Run `cargo vdev int show` to list available integrations/environments first.

Example fix

// before
cargo vdev compose_tests run --test aws_cloudwatch
// after (explicit environments)
cargo vdev compose_tests run --test aws_cloudwatch --environment aws-integration-tests
Defensive patterns

Strategy: validation

Validate before calling

let resolved: Vec<_> = if environments.is_empty() { config.environments().keys().cloned().collect() } else { environments.to_vec() };
if resolved.is_empty() { eprintln!("No environments to run for test '{test_name}'"); return; }

Type guard

fn has_environments(envs: &[String], config: &Config) -> bool { !envs.is_empty() || !config.environments().is_empty() }

Try / catch

match result { Err(e) if e.to_string().contains("No environments found") => { eprintln!("Configure environments first: see `cargo vdev int show`"); } Err(e) => return Err(e), Ok(v) => v }

Prevention

When it happens

Trigger: Running `cargo vdev compose_tests run --test <name>` with an explicit `--environment` list that is empty, or with no environments passed and `config.environments()` returning no keys for the resolved configuration.

Common situations: Developers hit this when the vdev local config defines no integration environments, when a typo'd or new test has no environments registered, or when running in a fresh clone where the integration environment config has not been set up.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/65996e6ccf075a06. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/compose_tests/run.rs:37

/// 4. Upload results to Datadog (in CI)
/// 5. Stop the environment (always, as cleanup)
pub fn exec(
    local_config: ComposeTestLocalConfig,
    test_name: &str,
    environments: &[String],
    retries: u8,
    coverage: bool,
    always_show_logs: bool,
) -> Result<()> {
    let resolved_envs: Vec<String> = if environments.is_empty() {
        let (_test_dir, config) = ComposeTestConfig::load(local_config.directory, test_name)?;
        config.environments().keys().cloned().collect()
    } else {
        environments.to_vec()
    };

    if resolved_envs.is_empty() {
        anyhow::bail!("No environments found for test '{test_name}'");
    }

    if coverage {
        super::test::clear_coverage();
    }

    let mut covered_environments = Vec::new();
    for environment in &resolved_envs {
        info!("Running test '{test_name}' in environment '{environment}'");

        cleanup_test_output(test_name)?;

        let start_result = super::start::exec(local_config, test_name, Some(environment));

        if let Err(ref e) = start_result {
            error!("Failed to start environment: {e}");
            print_compose_logs(local_config, test_name, environment);
        }

View on GitHub (pinned to bdb87aeaa4)