Skip to content

Commit

Permalink
fix: expand env for args (#4481)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsukhin authored Oct 20, 2023
1 parent a31083f commit 1df18ae
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/executor/artillery/pkg/runner/artillery.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func (r *ArtilleryRunner) Run(ctx context.Context, execution testkube.Execution)
if args[i] == "<runPath>" {
args[i] = path
}

args[i] = os.ExpandEnv(args[i])
}

runPath := testDir
Expand Down
3 changes: 3 additions & 0 deletions contrib/executor/curl/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ func (r *CurlRunner) Run(ctx context.Context, execution testkube.Execution) (res
}

args = append(args, execution.Args...)
for i := range args {
args[i] = os.ExpandEnv(args[i])
}

runPath := workingDir
outputPkg.PrintLogf("%s Test run command %s %s", ui.IconRocket, command, strings.Join(args, " "))
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/cypress/pkg/runner/cypress.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ func (r *CypressRunner) Run(ctx context.Context, execution testkube.Execution) (
if args[i] == "<envVars>" {
args[i] = strings.Join(envVars, ",")
}

args[i] = os.ExpandEnv(args[i])
}

// run cypress inside repo directory ignore execution error in case of failed test
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/ginkgo/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ func BuildGinkgoArgs(params map[string]string, path, runPath, reportFile string,
if args[i] == "<reportFile>" {
args[i] = reportFile
}

args[i] = os.ExpandEnv(args[i])
}

output.PrintLogf("%s Ginkgo arguments from params built: %s", ui.IconCheckMark, args)
Expand Down
1 change: 1 addition & 0 deletions contrib/executor/gradle/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func (r *GradleRunner) Run(ctx context.Context, execution testkube.Execution) (r
if args[i] == "<projectDir>" {
args[i] = project
}

args[i] = os.ExpandEnv(args[i])
}

Expand Down
4 changes: 4 additions & 0 deletions contrib/executor/jmeter/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ func (r *JMeterRunner) Run(ctx context.Context, execution testkube.Execution) (r
}
}

for i := range args {
args[i] = os.ExpandEnv(args[i])
}

output.PrintLogf("%s Using arguments: %v", ui.IconWorld, args)

entryPoint := getEntryPoint()
Expand Down
4 changes: 4 additions & 0 deletions contrib/executor/jmeterd/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ func (r *JMeterDRunner) Run(ctx context.Context, execution testkube.Execution) (
}
}

for i := range args {
args[i] = os.ExpandEnv(args[i])
}

output.PrintLogf("%s Using arguments: %v", ui.IconWorld, args)

entryPoint := getEntryPoint()
Expand Down
4 changes: 4 additions & 0 deletions contrib/executor/k6/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ func (r *K6Runner) Run(ctx context.Context, execution testkube.Execution) (resul
}
}

for i := range args {
args[i] = os.ExpandEnv(args[i])
}

command, args := executor.MergeCommandAndArgs(execution.Command, args)
outputPkg.PrintEvent("Running", directory, command, args)
runPath := directory
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/kubepug/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ func buildArgs(args []string, inputPath string) ([]string, error) {
if args[i] == "<runPath>" {
args[i] = inputPath
}

args[i] = os.ExpandEnv(args[i])
}
return args, nil
}
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/maven/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ func (r *MavenRunner) Run(ctx context.Context, execution testkube.Execution) (re
if args[i] == "<mavenHome>" {
args[i] = mavenHome
}

args[i] = os.ExpandEnv(args[i])
}

outputPkg.PrintEvent("Running goal: "+goal, mavenHome, mavenCommand, args)
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/playwright/pkg/runner/playwright.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (r *PlaywrightRunner) Run(ctx context.Context, execution testkube.Execution
if args[i] == "<depCommand>" {
args[i] = depCommand
}

args[i] = os.ExpandEnv(args[i])
}

envManager := env.NewManagerWithVars(execution.Variables)
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/postman/pkg/runner/newman/newman.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ func (r *NewmanRunner) Run(ctx context.Context, execution testkube.Execution) (r
if args[i] == "<runPath>" {
args[i] = path
}

args[i] = os.ExpandEnv(args[i])
}

runPath := ""
Expand Down
2 changes: 2 additions & 0 deletions contrib/executor/soapui/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ func setUpEnvironment(args []string, testFilePath string) {
if args[i] == "<runPath>" {
args[i] = testFilePath
}

args[i] = os.ExpandEnv(args[i])
}
os.Setenv("COMMAND_LINE", strings.Join(args, " "))
}
Expand Down
3 changes: 3 additions & 0 deletions contrib/executor/tracetest/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package runner
import (
"context"
"fmt"
"os"
"strings"

"github.com/kubeshop/testkube/contrib/executor/tracetest/pkg/model"
Expand Down Expand Up @@ -151,6 +152,8 @@ func buildArgs(args []string, tracetestEndpoint string, inputPath string) ([]str
if args[i] == "<filePath>" {
args[i] = inputPath
}

args[i] = os.ExpandEnv(args[i])
}
return args, nil
}
5 changes: 5 additions & 0 deletions contrib/executor/zap/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,10 @@ func MergeArgs(fileArgs []string, reportFile string, execution testkube.Executio
break
}
}

for i := range args {
args[i] = os.ExpandEnv(args[i])
}

return args
}

0 comments on commit 1df18ae

Please sign in to comment.