diff options
author | regnat <rg@regnat.ovh> | 2022-02-28 14:41:09 +0100 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2022-02-28 17:00:31 +0100 |
commit | b8f8aef9d3d026af474a4f7ef8f09678c3e5a7d4 (patch) | |
tree | e6dbfb144685ec2fb4ce928c5837107574be46f0 /tests | |
parent | b592359c565e0220545ba146b32f367e4ecdb23f (diff) |
tests: Fix the start of the daemon
- Make sure that it starts even without the `nix-command` xp feature
- Fail if it doesn’t manage to start
This fixes a 30s wait for every test in `init.sh` as the daemon couldn’t
start, but the code was just waiting 30s and continuing as if everything
was all right.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common.sh.in | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in index 49068f1c3..e485329ba 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -90,12 +90,18 @@ startDaemon() { # Start the daemon, wait for the socket to appear. !!! # ‘nix-daemon’ should have an option to fork into the background. rm -f $NIX_DAEMON_SOCKET_PATH - PATH=$DAEMON_PATH nix daemon & + PATH=$DAEMON_PATH nix-daemon& + pidDaemon=$! for ((i = 0; i < 300; i++)); do - if [[ -S $NIX_DAEMON_SOCKET_PATH ]]; then break; fi + if [[ -S $NIX_DAEMON_SOCKET_PATH ]]; then + DAEMON_STARTED=1 + break; + fi sleep 0.1 done - pidDaemon=$! + if [[ -z ${DAEMON_STARTED+x} ]]; then + fail "Didn’t manage to start the daemon" + fi trap "killDaemon" EXIT export NIX_REMOTE=daemon } |