From 5a89d5381d018e89eb1f2fe452666686a3649656 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Fri, 3 Feb 2017 17:18:26 -0500 Subject: [PATCH 1/2] Wait when restarting ocid during tests When we restart ocid as part of a test, wait for the daemon to exit when we send it a SIGTERM, just as we do when we try to stop it for good. Signed-off-by: Nalin Dahyabhai --- test/helpers.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/test/helpers.bash b/test/helpers.bash index c9a97ae3..ddfa86e3 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -197,6 +197,7 @@ function stop_ocid() { function restart_ocid() { if [ "$OCID_PID" != "" ]; then kill "$OCID_PID" >/dev/null 2>&1 + wait "$OCID_PID" start_ocid else echo "you must start ocid first" From ff5c485e7f744dd46367c3bb5ee285813313c733 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Fri, 3 Feb 2017 17:19:29 -0500 Subject: [PATCH 2/2] Make sure we don't read a host ocid.conf in tests When generating an ocid.conf for use when running tests, make sure we don't pick up any defaults from an installed copy of ocid by forcing our copy to read /dev/null as its configuration file. Signed-off-by: Nalin Dahyabhai --- test/helpers.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers.bash b/test/helpers.bash index ddfa86e3..d641ca48 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -136,7 +136,7 @@ function start_ocid() { "$BIN2IMG_BINARY" --root "$TESTDIR/ocid" --runroot "$TESTDIR/ocid-run" --source-binary "$PAUSE_BINARY" fi "$COPYIMG_BINARY" --root "$TESTDIR/ocid" --runroot "$TESTDIR/ocid-run" --image-name=redis --import-from=dir:"$ARTIFACTS_PATH"/redis-image --add-name=docker://docker.io/library/redis:latest --signature-policy="$INTEGRATION_ROOT"/policy.json - "$OCID_BINARY" --conmon "$CONMON_BINARY" --listen "$OCID_SOCKET" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/ocid" --runroot "$TESTDIR/ocid-run" --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$OCID_CNI_CONFIG" --signature-policy "$INTEGRATION_ROOT"/policy.json config >$OCID_CONFIG + "$OCID_BINARY" --conmon "$CONMON_BINARY" --listen "$OCID_SOCKET" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/ocid" --runroot "$TESTDIR/ocid-run" --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$OCID_CNI_CONFIG" --signature-policy "$INTEGRATION_ROOT"/policy.json --config /dev/null config >$OCID_CONFIG "$OCID_BINARY" --debug --config "$OCID_CONFIG" & OCID_PID=$! wait_until_reachable