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

feat(cli): allow selecting resource type when running multiple files #4020

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

schoren
Copy link
Contributor

@schoren schoren commented Sep 17, 2024

This PR enables the cli to filter files by resource types when running an entire directory. This allows to use a single command to launch multiple testsuites from a directory that also contains tests. For example:

$ tree tests
├── 01_step_1.yaml
├── 02_step_2.yaml
└── feature_test_suite.yaml

Until now, running tracetest run -f tests would cause to run 01_step_1.yaml, 02_step_2.yaml and feature_test_suite.yaml. This might not be desirable

Now, running tracetest run testsuite -f tests would cause to only run feature_test_suite.yaml.

Changes

Fixes

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

Loom video

Add your loom video here if your work can be visualized

Copy link

vercel bot commented Sep 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tracetest ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 4:32pm

func (o orchestrator) runByFiles(ctx context.Context, opts RunOptions, resourceFetcher runner.ResourceFetcher, vars *varset.VarSets, varsID string, runGroupID string) ([]any, []runner.RunResult, error) {
resources := make([]any, 0)
runsResults := make([]runner.RunResult, 0)
var mainErr error

hasDefinitionFilesDefined := opts.DefinitionFiles != nil && len(opts.DefinitionFiles) > 0
hasDefinitionFilesDefined := len(opts.DefinitionFiles) > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not related, but it was causing an annoying warning

Screenshot 2024-09-17 at 13 34 15

@@ -41,7 +41,6 @@ func ReadDirFileNames(path string) []string {

var result []string
for _, file := range files {
// TODO: add validation for file extensions, tracetest runnable definitions (?)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should not be handled here, and this PR addresses this todo

@schoren schoren requested review from xoscar and mathnogueira and removed request for xoscar September 17, 2024 17:31
Copy link
Contributor

@xoscar xoscar left a comment

Choose a reason for hiding this comment

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

GJ!

@schoren schoren merged commit 32519a3 into main Sep 17, 2024
40 checks passed
@schoren schoren deleted the run-matching-type branch September 17, 2024 17:37
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