Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmt: Add TMT_TEST env variable to specify single test to run #890

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

ckyrouac
Copy link
Contributor

@ckyrouac ckyrouac commented Nov 8, 2024

e.g. TMT_TEST=test-21-logically-bound-switch make test-tmt will run all the tmt setup code then run test-21-logically-bound-switch. This is useful when developing a test.

@cgwalters
Copy link
Collaborator

Yes! I was literally looking for this 10 minutes ago 😄

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK as is, just an optional suggestion

xtask/src/xtask.rs Outdated Show resolved Hide resolved
Err(_) => all_plan_files(sh)?,
};

println!("Discovered plans: {tests:?}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now when TMT_TEST is set we'll now only say that we discovered what they asked for right?

How about doing this like:

let mut tests = all_plan_files()?;
if let Ok(name) std::env::var("TMT_TEST") {
    tests.retain(|x| x.1.as_str() == name);
    if tests.is_empty() {
        anyhow::bail!("Failed to match test: {name}");
    }
}

or so

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, updated

e.g. `TMT_TEST=test-21-logically-bound-switch make test-tmt`
will run all the tmt setup code then run test-21-logically-bound-switch.
This is useful when developing a test.

Signed-off-by: Chris Kyrouac <ckyrouac@redhat.com>
@ckyrouac ckyrouac enabled auto-merge November 8, 2024 20:35
@ckyrouac ckyrouac merged commit 4cf27d9 into containers:main Nov 8, 2024
16 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants