Skip to content

Commit

Permalink
Allow to pick module tests when running local-preview
Browse files Browse the repository at this point in the history
Signed-off-by: tomasmik <[email protected]>
  • Loading branch information
tomasmik committed Dec 1, 2023
1 parent 9fdbd74 commit 93fb914
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/cmd/module/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ var flagDisregardGitignore = &cli.BoolFlag{
Name: "disregard-gitignore",
Usage: "[Optional] Disregard the .gitignore file when reading files in a directory",
}

var flagTests = &cli.StringSliceFlag{
Name: "tests",
Usage: "[Optional] Provide a list of tests to run",
}
7 changes: 6 additions & 1 deletion internal/cmd/module/local_preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,17 @@ func localPreview() cli.ActionFunc {
}

var triggerMutation struct {
VersionProposeLocalWorkspace []runQuery `graphql:"versionProposeLocalWorkspace(module: $module, workspace: $workspace)"`
VersionProposeLocalWorkspace []runQuery `graphql:"versionProposeLocalWorkspace(module: $module, workspace: $workspace, testIds: $testIds)"`
}

tests := []graphql.String{}
for _, test := range cliCtx.StringSlice(flagTests.Name) {
tests = append(tests, graphql.String(test))
}
triggerVariables := map[string]interface{}{
"module": graphql.ID(moduleID),
"workspace": graphql.ID(uploadMutation.UploadLocalWorkspace.ID),
"testIds": tests,
}

var requestOpts []graphql.RequestOption
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func Command() *cli.Command {
flagNoUpload,
flagRunMetadata,
flagDisregardGitignore,
flagTests,
},
Action: localPreview(),
Before: authenticated.Ensure,
Expand Down

0 comments on commit 93fb914

Please sign in to comment.