projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
7582: Runner uploads results. Feature complete.
[arvados.git]
/
sdk
/
go
/
arvadostest
/
run_servers.go
diff --git
a/sdk/go/arvadostest/run_servers.go
b/sdk/go/arvadostest/run_servers.go
index cad16917dba286504f6693cac3a3fbd4d05a741e..27c552a4e104094ca2ed15991e310a3b7e9cd65e 100644
(file)
--- a/
sdk/go/arvadostest/run_servers.go
+++ b/
sdk/go/arvadostest/run_servers.go
@@
-9,6
+9,7
@@
import (
"log"
"os"
"os/exec"
"log"
"os"
"os/exec"
+ "strconv"
"strings"
)
"strings"
)
@@
-98,12
+99,21
@@
func StopAPI() {
exec.Command("python", "run_test_server.py", "stop").Run()
}
exec.Command("python", "run_test_server.py", "stop").Run()
}
-func StartKeep() {
+// 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()
cwd, _ := os.Getwd()
defer os.Chdir(cwd)
chdirToPythonTests()
- cmd := exec.Command("python", "run_test_server.py", "start_keep")
+ cmdArgs := []string{"run_test_server.py", "start_keep", "--num-keep-servers", strconv.Itoa(numKeepServers)}
+ if enforcePermissions {
+ cmdArgs = append(cmdArgs, "--keep-enforce-permissions")
+ }
+
+ cmd := exec.Command("python", cmdArgs...)
+
stderr, err := cmd.StderrPipe()
if err != nil {
log.Fatalf("Setting up stderr pipe: %s", err)
stderr, err := cmd.StderrPipe()
if err != nil {
log.Fatalf("Setting up stderr pipe: %s", err)
@@
-114,10
+124,13
@@
func StartKeep() {
}
}
}
}
-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()
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)
)
}
}