7167: Always pass --num-keep-servers to python wrapper. Update comments.
authorTom Clegg <tom@curoverse.com>
Thu, 15 Oct 2015 15:02:30 +0000 (11:02 -0400)
committerTom Clegg <tom@curoverse.com>
Thu, 15 Oct 2015 15:02:30 +0000 (11:02 -0400)
sdk/go/arvadostest/run_servers.go

index 68153b8b5119e4094698a3edbb26d7284ba6dcbc..d20a0959a6bbf078bfc311ddca298d440591f65d 100644 (file)
@@ -99,23 +99,19 @@ func StopAPI() {
        exec.Command("python", "run_test_server.py", "stop").Run()
 }
 
-// StartKeep is used to start keep servers
-// with needMore = false and enforcePermissions = false
+// StartKeep starts 2 keep servers with enforcePermissions=false
 func StartKeep() {
        StartKeepWithParams(2, false)
 }
 
-// StartKeepWithParams is used to start keep servers while specifying
-// numKeepServers and enforcePermissions parameters.
+// StartKeepWithParams starts the given number of keep servers,
+// optionally with -enforce-permissions enabled.
 func StartKeepWithParams(numKeepServers int, enforcePermissions bool) {
        cwd, _ := os.Getwd()
        defer os.Chdir(cwd)
        chdirToPythonTests()
 
-       cmdArgs := []string{"run_test_server.py", "start_keep"}
-       if numKeepServers != 2 {
-               cmdArgs = append(cmdArgs, "--num-keep-servers", strconv.Itoa(numKeepServers))
-       }
+       cmdArgs := []string{"run_test_server.py", "start_keep", "--num-keep-servers", strconv.Itoa(numKeepServers)}
        if enforcePermissions {
                cmdArgs = append(cmdArgs, "--keep-enforce-permissions")
        }
@@ -136,17 +132,13 @@ func StopKeep() {
        StopKeepServers(2)
 }
 
-// StopKeepServers is used to stop keep servers while specifying numKeepServers
+// StopKeepServers stops keep servers that were started with
+// StartKeep. numkeepServers should be the same value that was passed
+// to StartKeep.
 func StopKeepServers(numKeepServers int) {
        cwd, _ := os.Getwd()
        defer os.Chdir(cwd)
        chdirToPythonTests()
 
-       cmdArgs := []string{"run_test_server.py", "stop_keep"}
-
-       if numKeepServers != 2 {
-               cmdArgs = append(cmdArgs, "--num-keep-servers", strconv.Itoa(numKeepServers))
-       }
-
-       exec.Command("python", cmdArgs...)
+       exec.Command("python", "run_test_server.py", "stop_keep", "--num-keep-servers", strconv.Itoa(numKeepServers))
 }