exec.Command("python", "run_test_server.py", "stop").Run()
}
+// StartKeep is used to start keep servers
+// with keepExisting = false and enforcePermissions = false
func StartKeep() {
- StartKeepAdditional(false)
+ StartKeepWithParams(false, false)
}
-func StartKeepAdditional(keepExisting bool) {
+// StartKeepWithParams is used to start keep servers while specifying
+// keepExisting and enforcePermissions parameters.
+func StartKeepWithParams(keepExisting bool, enforcePermissions bool) {
cwd, _ := os.Getwd()
defer os.Chdir(cwd)
chdirToPythonTests()
- cmd := exec.Command("python", "run_test_server.py", "start_keep")
+ keepExistingStr := ""
if keepExisting {
- cmd = exec.Command("python", "run_test_server.py", "start_keep", "--keep_existing", "true")
+ keepExistingStr = "true"
}
+ enforcePermissionsStr := ""
+ if enforcePermissions {
+ enforcePermissionsStr = "true"
+ }
+ cmd := exec.Command("python", "run_test_server.py", "start_keep", "--keep-existing", keepExistingStr, "--keep-enforce-permissions", enforcePermissionsStr)
+
stderr, err := cmd.StderrPipe()
if err != nil {
log.Fatalf("Setting up stderr pipe: %s", err)
my_api_host = None
_cached_config = {}
-keep_existing = None
+keep_existing = False
+enforce_permissions = False
def find_server_pid(PID_PATH, wait=10):
now = time.time()
return port
-def run_keep(blob_signing_key=None, enforce_permissions=False):
- if keep_existing is None:
+def run_keep(blob_signing_key=None):
+ if not keep_existing:
stop_keep()
keep_args = {}
start_index = 0
end_index = 2
- if keep_existing is not None:
+ if keep_existing:
start_index = 2
end_index = 3
for d in range(start_index, end_index):
parser = argparse.ArgumentParser()
parser.add_argument('action', type=str, help="one of {}".format(actions))
parser.add_argument('--auth', type=str, metavar='FIXTURE_NAME', help='Print authorization info for given api_client_authorizations fixture')
- parser.add_argument('--keep_existing', type=str, help="Used to add additional keep servers, without terminating existing servers")
+ parser.add_argument('--keep-existing', type=str, help="Used to add additional keep servers, without terminating existing servers")
+ parser.add_argument('--keep-enforce-permissions', type=str, help="Enforce keep permissions")
+
args = parser.parse_args()
- keep_existing = args.keep_existing
+ if args.keep_existing == 'true':
+ keep_existing = True
+ if args.keep_enforce_permissions == 'true':
+ enforce_permissions = True
if args.action not in actions:
print("Unrecognized action '{}'. Actions are: {}.".format(args.action, actions), file=sys.stderr)
c.Assert(err, Equals, nil)
// Create two more keep servers to be used as destination
- arvadostest.StartKeepAdditional(true)
+ arvadostest.StartKeepWithParams(true, false)
// load kcDst
kcDst, err = keepclient.MakeKeepClient(&arvDst)