X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/20135b59855216b0ccd8154795e359c4bd11d456..192e5a9d12fb9fd16baff2b61af011611b671983:/sdk/go/arvadostest/run_servers.go diff --git a/sdk/go/arvadostest/run_servers.go b/sdk/go/arvadostest/run_servers.go index 0b60709c62..27c552a4e1 100644 --- a/sdk/go/arvadostest/run_servers.go +++ b/sdk/go/arvadostest/run_servers.go @@ -9,6 +9,7 @@ import ( "log" "os" "os/exec" + "strconv" "strings" ) @@ -98,23 +99,15 @@ func StopAPI() { exec.Command("python", "run_test_server.py", "stop").Run() } -// StartKeep is used to start keep servers -// with keepExisting = false and enforcePermissions = false -func StartKeep() { - StartKeepWithParams(false, false) -} - -// StartKeepWithParams is used to start keep servers while specifying -// keepExisting and enforcePermissions parameters. -func StartKeepWithParams(keepExisting bool, enforcePermissions bool) { +// StartKeep starts the given number of keep servers, +// optionally with -enforce-permissions enabled. +// Use numKeepServers = 2 and enforcePermissions = false under all normal circumstances. +func StartKeep(numKeepServers int, enforcePermissions bool) { cwd, _ := os.Getwd() defer os.Chdir(cwd) chdirToPythonTests() - cmdArgs := []string{"run_test_server.py", "start_keep"} - if keepExisting { - cmdArgs = append(cmdArgs, "--keep-existing") - } + cmdArgs := []string{"run_test_server.py", "start_keep", "--num-keep-servers", strconv.Itoa(numKeepServers)} if enforcePermissions { cmdArgs = append(cmdArgs, "--keep-enforce-permissions") } @@ -131,10 +124,13 @@ func StartKeepWithParams(keepExisting bool, enforcePermissions bool) { } } -func StopKeep() { +// StopKeep stops keep servers that were started with StartKeep. +// numkeepServers should be the same value that was passed to StartKeep, +// which is 2 under all normal circumstances. +func StopKeep(numKeepServers int) { cwd, _ := os.Getwd() defer os.Chdir(cwd) chdirToPythonTests() - exec.Command("python", "run_test_server.py", "stop_keep").Run() + exec.Command("python", "run_test_server.py", "stop_keep", "--num-keep-servers", strconv.Itoa(numKeepServers)) }