Files
lix/tests/functional/daemon-trust.sh
T
hexchen 57658b2146 tests/functional/daemon-trust: fallback to uid
The test would fail if the identity cannot be determined
(as is the case e.g. when using auto-allocate-uids under darwin).
Instead we use the uid when the user name is not available.

Fixes: #1025

Signed-off-by: hexchen <hexchen@lilwit.ch>
Change-Id: I12f35840b78f989b5fd09bbd44c833dc6a6a6964
2025-11-03 18:24:07 +01:00

38 lines
683 B
Bash

source common.sh
clearStore
effectiveUser() {
whoami || id -u
}
withDaemonTrusting() {
local trusting="$1"
shift
trap killDaemon EXIT
NIX_CONFIG="
extra-experimental-features = daemon-trust-override
trusted-users = $trusting
" startDaemon "$@"
}
(
withDaemonTrusting "" --default-trust
nix store ping --json | jq -e '.trusted | not'
)
(
withDaemonTrusting "" --force-trusted
nix store ping --json | jq -e '.trusted'
)
(
withDaemonTrusting "$(effectiveUser)" --default-trust
nix store ping --json | jq -e '.trusted'
)
(
withDaemonTrusting "$(effectiveUser)" --force-untrusted
nix store ping --json | jq -e '.trusted | not'
)