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
This commit is contained in:
hexchen
2025-11-03 18:24:07 +01:00
parent d4f404ded3
commit 57658b2146
+6 -2
View File
@@ -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'
)