mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Merge remote-tracking branch 'upstream/master' into lfs
This commit is contained in:
commit
b08b7bee4e
101 changed files with 2148 additions and 395 deletions
|
@ -26,6 +26,8 @@ let
|
|||
|
||||
# Evaluate VMs faster
|
||||
documentation.enable = false;
|
||||
# this links against nix and might break with our git version.
|
||||
system.tools.nixos-option.enable = false;
|
||||
};
|
||||
_module.args.nixpkgs = nixpkgs;
|
||||
_module.args.system = system;
|
||||
|
@ -157,6 +159,8 @@ in
|
|||
|
||||
functional_root = runNixOSTestFor "x86_64-linux" ./functional/as-root.nix;
|
||||
|
||||
functional_symlinked-home = runNixOSTestFor "x86_64-linux" ./functional/symlinked-home.nix;
|
||||
|
||||
user-sandboxing = runNixOSTestFor "x86_64-linux" ./user-sandboxing;
|
||||
|
||||
s3-binary-cache-store = runNixOSTestFor "x86_64-linux" ./s3-binary-cache-store.nix;
|
||||
|
|
36
tests/nixos/functional/symlinked-home.nix
Normal file
36
tests/nixos/functional/symlinked-home.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
This test runs the functional tests on a NixOS system where the home directory
|
||||
is symlinked to another location.
|
||||
|
||||
The purpose of this test is to find cases where Nix uses low-level operations
|
||||
that don't support symlinks on paths that include them.
|
||||
|
||||
It is not a substitute for more intricate, use case-specific tests, but helps
|
||||
catch common issues.
|
||||
*/
|
||||
# TODO: add symlinked tmpdir
|
||||
{ ... }:
|
||||
{
|
||||
name = "functional-tests-on-nixos_user_symlinked-home";
|
||||
|
||||
imports = [ ./common.nix ];
|
||||
|
||||
nodes.machine = {
|
||||
users.users.alice = { isNormalUser = true; };
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
with subtest("prepare symlinked home"):
|
||||
machine.succeed("""
|
||||
(
|
||||
set -x
|
||||
mv /home/alice /home/alice.real
|
||||
ln -s alice.real /home/alice
|
||||
) 1>&2
|
||||
""")
|
||||
machine.succeed("""
|
||||
su --login --command "run-test-suite" alice >&2
|
||||
""")
|
||||
'';
|
||||
}
|
|
@ -10,6 +10,7 @@ let
|
|||
env = "AWS_ACCESS_KEY_ID=${accessKey} AWS_SECRET_ACCESS_KEY=${secretKey}";
|
||||
|
||||
storeUrl = "s3://my-cache?endpoint=http://server:9000®ion=eu-west-1";
|
||||
objectThatDoesNotExist = "s3://my-cache/foo-that-does-not-exist?endpoint=http://server:9000®ion=eu-west-1";
|
||||
|
||||
in {
|
||||
name = "s3-binary-cache-store";
|
||||
|
@ -20,7 +21,10 @@ in {
|
|||
{ virtualisation.writableStore = true;
|
||||
virtualisation.additionalPaths = [ pkgA ];
|
||||
environment.systemPackages = [ pkgs.minio-client ];
|
||||
nix.extraOptions = "experimental-features = nix-command";
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command
|
||||
substituters =
|
||||
'';
|
||||
services.minio = {
|
||||
enable = true;
|
||||
region = "eu-west-1";
|
||||
|
@ -35,7 +39,10 @@ in {
|
|||
client =
|
||||
{ config, pkgs, ... }:
|
||||
{ virtualisation.writableStore = true;
|
||||
nix.extraOptions = "experimental-features = nix-command";
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command
|
||||
substituters =
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -54,6 +61,12 @@ in {
|
|||
# Test fetchurl on s3:// URLs while we're at it.
|
||||
client.succeed("${env} nix eval --impure --expr 'builtins.fetchurl { name = \"foo\"; url = \"s3://my-cache/nix-cache-info?endpoint=http://server:9000®ion=eu-west-1\"; }'")
|
||||
|
||||
# Test that the format string in the error message is properly setup and won't display `%s` instead of the failed URI
|
||||
msg = client.fail("${env} nix eval --impure --expr 'builtins.fetchurl { name = \"foo\"; url = \"${objectThatDoesNotExist}\"; }' 2>&1")
|
||||
if "S3 object '${objectThatDoesNotExist}' does not exist" not in msg:
|
||||
print(msg) # So that you can see the message that was improperly formatted
|
||||
raise Exception("Error message formatting didn't work")
|
||||
|
||||
# Copy a package from the binary cache.
|
||||
client.fail("nix path-info ${pkgA}")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue