mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 00:02:25 +00:00
Add test
This commit is contained in:
parent
46d9e70c20
commit
00ce36fafe
@ -187,9 +187,14 @@ in
|
|||||||
client.succeed("nix flake metadata nixpkgs --tarball-ttl 0 >&2")
|
client.succeed("nix flake metadata nixpkgs --tarball-ttl 0 >&2")
|
||||||
|
|
||||||
# Test fetchTree on a github URL.
|
# Test fetchTree on a github URL.
|
||||||
hash = client.succeed(f"nix eval --raw --expr '(fetchTree {info['url']}).narHash'")
|
hash = client.succeed(f"nix eval --no-trust-tarballs-from-git-forges --raw --expr '(fetchTree {info['url']}).narHash'")
|
||||||
assert hash == info['locked']['narHash']
|
assert hash == info['locked']['narHash']
|
||||||
|
|
||||||
|
# Fetching without a narHash should succeed if trust-github is set and fail otherwise.
|
||||||
|
client.succeed(f"nix eval --raw --expr 'builtins.fetchTree github:github:fancy-enterprise/private-flake/{info['revision']}'")
|
||||||
|
out = client.fail(f"nix eval --no-trust-tarballs-from-git-forges --raw --expr 'builtins.fetchTree github:github:fancy-enterprise/private-flake/{info['revision']}' 2>&1")
|
||||||
|
assert "will not fetch unlocked input" in out, "--no-trust-tarballs-from-git-forges did not fail with the expected error"
|
||||||
|
|
||||||
# Shut down the web server. The flake should be cached on the client.
|
# Shut down the web server. The flake should be cached on the client.
|
||||||
github.succeed("systemctl stop httpd.service")
|
github.succeed("systemctl stop httpd.service")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user