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: change logic for detecting jmeter run mode #4745

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/executor/jmeterd/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (r *JMeterDRunner) Run(ctx context.Context, execution testkube.Execution) (
}
mode := jmeterModeStandalone
jmeterParamFlag := standaloneJMeterParamPrefix
if slavesCount > 1 {
if slavesCount > 0 {
mode = jmeterModeDistributed
jmeterParamFlag = globalJMeterParamPrefix
}
Expand Down
10 changes: 5 additions & 5 deletions contrib/executor/jmeterd/pkg/slaves/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

const (
defaultSlavesCount = 1
defaultSlavesCount = 0
serverPort = 1099
localPort = 60001
)
Expand Down Expand Up @@ -90,14 +90,14 @@ func GetSlavesCount(vars map[string]testkube.Variable) (int, error) {
return defaultSlavesCount, nil
}

replicaCount, err := strconv.Atoi(count.Value)
slavesCount, err := strconv.Atoi(count.Value)
if err != nil {
return 0, errors.Errorf("invalid SLAVES_COUNT value, expected integer, got: %v", count.Value)
}
if replicaCount < 1 {
return 0, errors.Errorf("SLAVES_COUNT must be at least 1")
if slavesCount < 0 {
return 0, errors.Errorf("SLAVES_COUNT cannot be less than 0, got: %v", count.Value)
}
return replicaCount, err
return slavesCount, err
}

func validateAndGetSlavePodName(testName string, executionId string, currentSlaveCount int) string {
Expand Down
Loading