diff --git a/dev/loadgen/README.md b/dev/loadgen/README.md index 266ae4ff3ece40..349aafdbe880a2 100644 --- a/dev/loadgen/README.md +++ b/dev/loadgen/README.md @@ -13,7 +13,7 @@ You can find a short explanation of this tool in this [loom video](https://www.l `gpctl clusters get-tls-config` - Port-forward ws-manager `kubectl port-forward deployment/ws-manager 12001:8080` -- Now you can start the benchmark with loadgen. If you want to keep the workspaces around after testing, add --interactive. Loadgen will then ask you before taking any destructive action. +- Now you can start the benchmark with loadgen. If you want to keep the workspaces around after testing, add --interactive. Loadgen will then ask you before taking any destructive action. If you do not specify `--interative` loadgen will wait 2 minutes before workspaces are deleted. `loadgen benchmark [config-file] --host localhost:12001 --tls ./wsman-tls --interactive` In order to configure the benchmark, you can use the configuration file diff --git a/dev/loadgen/cmd/benchmark.go b/dev/loadgen/cmd/benchmark.go index d6161bd2ec40e1..5eab24e25ec0dc 100644 --- a/dev/loadgen/cmd/benchmark.go +++ b/dev/loadgen/cmd/benchmark.go @@ -152,7 +152,7 @@ var benchmarkCommand = &cobra.Command{ } }, Termination: func(executor loadgen.Executor) error { - return handleWorkspaceDeletion(scenario.StoppingTimeout, executor) + return handleWorkspaceDeletion(scenario.StoppingTimeout, executor, false) }, } @@ -165,7 +165,7 @@ var benchmarkCommand = &cobra.Command{ // cancel workspace creation so that no new workspaces are created while we are deleting them scancel() - if err := handleWorkspaceDeletion(scenario.StoppingTimeout, session.Executor); err != nil { + if err := handleWorkspaceDeletion(scenario.StoppingTimeout, session.Executor, true); err != nil { log.Warnf("could not delete workspaces: %v", err) os.Exit(1) } @@ -198,21 +198,21 @@ type BenchmarkScenario struct { WorkspaceClass string `json:"workspaceClass"` } -func handleWorkspaceDeletion(timeout string, executor loadgen.Executor) error { +func handleWorkspaceDeletion(timeout string, executor loadgen.Executor, canceled bool) error { if runOpts.Interactive { if !confirmDeletion() { return nil } - if err := stopWorkspaces(timeout, executor); err != nil { - return err - } + return stopWorkspaces(timeout, executor) } else { - if err := stopWorkspaces(timeout, executor); err != nil { - return err + if !canceled { + fmt.Println("Waiting for 2 minutes before deleting workspaces") + time.Sleep(2 * time.Minute) } + + return stopWorkspaces(timeout, executor) } - return nil } func confirmDeletion() bool {