Skip to content

Commit

Permalink
fix: format test cli args
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Sep 10, 2024
1 parent 0403e84 commit ede914a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 12 additions & 2 deletions cmd/kubectl-testkube/commands/tests/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,12 @@ func newExecutionRequestFromFlags(cmd *cobra.Command) (request *testkube.Executi
return nil, err
}

executorArgs, err := cmd.Flags().GetStringArray("executor-args")
binaryArgs, err := cmd.Flags().GetStringArray("executor-args")
if err != nil {
return nil, err
}

executorArgs, err := testkube.PrepareExecutorArgs(binaryArgs)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1044,7 +1049,12 @@ func newExecutionUpdateRequestFromFlags(cmd *cobra.Command) (request *testkube.E
}

if cmd.Flag("executor-args").Changed {
executorArgs, err := cmd.Flags().GetStringArray("executor-args")
binaryArgs, err := cmd.Flags().GetStringArray("executor-args")
if err != nil {
return nil, err
}

executorArgs, err := testkube.PrepareExecutorArgs(binaryArgs)
if err != nil {
return nil, err
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/kubectl-testkube/commands/tests/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewRunTestCmd() *cobra.Command {
image string
iterations int
watchEnabled bool
executorArgs []string
binaryArgs []string
variables []string
secretVariables []string
variablesFile string
Expand Down Expand Up @@ -115,6 +115,9 @@ func NewRunTestCmd() *cobra.Command {
variables, err := common.CreateVariables(cmd, !info.SecretConfig().AutoCreate)
ui.WarnOnErrorAndOutputPretty("getting variables", outputPretty, err)

executorArgs, err := testkube.PrepareExecutorArgs(binaryArgs)
ui.ExitOnError("getting args", err)

envConfigMaps, envSecrets, err := newEnvReferencesFromFlags(cmd)
ui.WarnOnErrorAndOutputPretty("getting env config maps and secrets", outputPretty, err)

Expand Down Expand Up @@ -412,7 +415,7 @@ func NewRunTestCmd() *cobra.Command {
cmd.Flags().StringArrayVarP(&variables, "variable", "v", []string{}, "execution variable passed to executor")
cmd.Flags().StringArrayVarP(&secretVariables, "secret-variable", "s", []string{}, "execution secret variable passed to executor")
cmd.Flags().StringArrayVar(&command, "command", []string{}, "command passed to image in executor")
cmd.Flags().StringArrayVarP(&executorArgs, "args", "", []string{}, "executor binary additional arguments")
cmd.Flags().StringArrayVarP(&binaryArgs, "args", "", []string{}, "executor binary additional arguments")
cmd.Flags().StringVarP(&argsMode, "args-mode", "", "append", "usage mode for argumnets. one of append|override|replace")
cmd.Flags().BoolVarP(&watchEnabled, "watch", "f", false, "watch for changes after start")
cmd.Flags().StringVar(&downloadDir, "download-dir", "artifacts", "download dir")
Expand Down

0 comments on commit ede914a

Please sign in to comment.