Skip to content

Commit

Permalink
Use nix daemon in the test suite
Browse files Browse the repository at this point in the history
As part of the CLI stabilization effort, the last remaining checkbox (at
the moment) for `nix daemon` is that it "needs testing". This implements
the proposal of using `nix daemon` in place of `nix-daemon`.
  • Loading branch information
cole-h committed Dec 18, 2023
1 parent 5d5b25f commit b471a69
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/functional/build-remote-trustless-should-pass-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source common.sh

# Remote trusts us
file=build-hook.nix
prog=nix-daemon
prog='nix%20daemon'
proto=ssh-ng

source build-remote-trustless.sh
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/common/vars-and-functions.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ startDaemon() {
fi
# Start the daemon, wait for the socket to appear.
rm -f $NIX_DAEMON_SOCKET_PATH
PATH=$DAEMON_PATH nix-daemon &
PATH=$DAEMON_PATH nix --extra-experimental-features 'nix-command' daemon &
_NIX_TEST_DAEMON_PID=$!
export _NIX_TEST_DAEMON_PID
for ((i = 0; i < 300; i++)); do
Expand Down Expand Up @@ -148,7 +148,7 @@ fi
isDaemonNewer () {
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
local requiredVersion="$1"
local daemonVersion=$($NIX_DAEMON_PACKAGE/bin/nix-daemon --version | cut -d' ' -f3)
local daemonVersion=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version | cut -d' ' -f3)
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]]
}

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/nix-daemon-untrusting.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

exec nix-daemon --force-untrusted "$@"
exec nix daemon --force-untrusted "$@"
2 changes: 1 addition & 1 deletion tests/functional/store-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ STORE_INFO_JSON=$(nix store info --json)
echo "$STORE_INFO" | grep "Store URL: ${NIX_REMOTE}"

if [[ -v NIX_DAEMON_PACKAGE ]] && isDaemonNewer "2.7.0pre20220126"; then
DAEMON_VERSION=$($NIX_DAEMON_PACKAGE/bin/nix-daemon --version | cut -d' ' -f3)
DAEMON_VERSION=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version | cut -d' ' -f3)
echo "$STORE_INFO" | grep "Version: $DAEMON_VERSION"
[[ "$(echo "$STORE_INFO_JSON" | jq -r ".version")" == "$DAEMON_VERSION" ]]
fi
Expand Down

0 comments on commit b471a69

Please sign in to comment.