diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-02-07 15:47:19 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-02-07 15:49:02 +0100 |
commit | 5193807750853a592bb7d0202a998d1f2c780cf2 (patch) | |
tree | 173f7d69241037ecad7c8e43d205d4b608a42b6d /nixos/tests | |
parent | cc0caac098b56b67300778c8a1738f8a16e08442 (diff) |
VM tests: Initialize the Nix database with correct NAR hashes/sizes
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/misc.nix | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix index 6de17518214c6..4fd9466dc5027 100644 --- a/nixos/tests/misc.nix +++ b/nixos/tests/misc.nix @@ -1,11 +1,13 @@ # Miscellaneous small tests that don't warrant their own VM run. -import ./make-test.nix ({ pkgs, ...} : { +import ./make-test.nix ({ pkgs, ...} : rec { name = "misc"; meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ eelco chaoflow ]; }; + foo = pkgs.writeText "foo" "Hello World"; + machine = { config, lib, pkgs, ... }: with lib; @@ -27,10 +29,17 @@ import ./make-test.nix ({ pkgs, ...} : { security.sudo = { enable = true; wheelNeedsPassword = false; }; boot.kernel.sysctl."vm.swappiness" = 1; boot.kernelParams = [ "vsyscall=emulate" ]; + system.extraDependencies = [ foo ]; }; testScript = '' + subtest "nix-db", sub { + my $json = $machine->succeed("nix path-info --json ${foo}"); + $json =~ /"narHash":"sha256:0afw0d9j1hvwiz066z93jiddc33nxg6i6qyp26vnqyglpyfivlq5"/ or die "narHash not set"; + $json =~ /"narSize":128/ or die "narSize not set"; + }; + subtest "nixos-version", sub { $machine->succeed("[ `nixos-version | wc -w` = 2 ]"); }; |