Merge pull request #6159 from NixOS/more-eager-daemon-polling-in-tests

testS: poll more eagerly for the daemon start/stop
This commit is contained in:
Eelco Dolstra 2022-02-24 17:54:09 +01:00 committed by GitHub
commit 7ec244aec2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,9 +91,9 @@ startDaemon() {
# nix-daemon should have an option to fork into the background. # nix-daemon should have an option to fork into the background.
rm -f $NIX_DAEMON_SOCKET_PATH rm -f $NIX_DAEMON_SOCKET_PATH
PATH=$DAEMON_PATH nix daemon & PATH=$DAEMON_PATH nix daemon &
for ((i = 0; i < 30; i++)); do for ((i = 0; i < 300; i++)); do
if [[ -S $NIX_DAEMON_SOCKET_PATH ]]; then break; fi if [[ -S $NIX_DAEMON_SOCKET_PATH ]]; then break; fi
sleep 1 sleep 0.1
done done
pidDaemon=$! pidDaemon=$!
trap "killDaemon" EXIT trap "killDaemon" EXIT
@ -102,9 +102,9 @@ startDaemon() {
killDaemon() { killDaemon() {
kill $pidDaemon kill $pidDaemon
for i in {0.10}; do for i in {0..100}; do
kill -0 $pidDaemon || break kill -0 $pidDaemon || break
sleep 1 sleep 0.1
done done
kill -9 $pidDaemon || true kill -9 $pidDaemon || true
wait $pidDaemon || true wait $pidDaemon || true