From 57658b2146be88649eed992854d6ce0c192957b9 Mon Sep 17 00:00:00 2001 From: hexchen Date: Mon, 3 Nov 2025 14:02:43 +0100 Subject: [PATCH] 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 Change-Id: I12f35840b78f989b5fd09bbd44c833dc6a6a6964 --- tests/functional/daemon-trust.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/functional/daemon-trust.sh b/tests/functional/daemon-trust.sh index 52790ed9d..ae3624662 100644 --- a/tests/functional/daemon-trust.sh +++ b/tests/functional/daemon-trust.sh @@ -2,6 +2,10 @@ source common.sh clearStore +effectiveUser() { + whoami || id -u +} + withDaemonTrusting() { local trusting="$1" shift @@ -24,10 +28,10 @@ trusted-users = $trusting ) ( - withDaemonTrusting "$(whoami)" --default-trust + withDaemonTrusting "$(effectiveUser)" --default-trust nix store ping --json | jq -e '.trusted' ) ( - withDaemonTrusting "$(whoami)" --force-untrusted + withDaemonTrusting "$(effectiveUser)" --force-untrusted nix store ping --json | jq -e '.trusted | not' )