mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
tests.testers.nixosTest-example: move from tests.nixos-functions.nixosTest-test
And improve the test a bit, to assert correct wiring of `pkgs`.
This commit is contained in:
parent
ae172a2bb4
commit
93abb7bef7
8
pkgs/build-support/testers/test/README.md
Normal file
8
pkgs/build-support/testers/test/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Tests _for the testers_
|
||||
|
||||
cd nixpkgs
|
||||
nix-build -A tests.testers
|
||||
|
||||
Tests generally derive their own correctness from simplicity, which in the
|
||||
case of testers (themselves functions) does not always work out.
|
||||
Hence the need for tests that test the testers.
|
27
pkgs/build-support/testers/test/default.nix
Normal file
27
pkgs/build-support/testers/test/default.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ testers, lib, pkgs, ... }:
|
||||
let
|
||||
pkgs-with-overlay = pkgs.extend(final: prev: {
|
||||
proof-of-overlay-hello = prev.hello;
|
||||
});
|
||||
|
||||
dummyVersioning = {
|
||||
revision = "test";
|
||||
versionSuffix = "test";
|
||||
label = "test";
|
||||
};
|
||||
|
||||
in
|
||||
lib.recurseIntoAttrs {
|
||||
# Check that the wiring of nixosTest is correct.
|
||||
# Correct operation of the NixOS test driver should be asserted elsewhere.
|
||||
nixosTest-example = pkgs-with-overlay.testers.nixosTest ({ lib, pkgs, figlet, ... }: {
|
||||
name = "nixosTest-test";
|
||||
nodes.machine = { pkgs, ... }: {
|
||||
system.nixos = dummyVersioning;
|
||||
environment.systemPackages = [ pkgs.proof-of-overlay-hello figlet ];
|
||||
};
|
||||
testScript = ''
|
||||
machine.succeed("hello | figlet >/dev/console")
|
||||
'';
|
||||
});
|
||||
}
|
@ -67,6 +67,8 @@ with pkgs;
|
||||
|
||||
writers = callPackage ../build-support/writers/test.nix {};
|
||||
|
||||
testers = callPackage ../build-support/testers/test/default.nix {};
|
||||
|
||||
dhall = callPackage ./dhall { };
|
||||
|
||||
makeWrapper = callPackage ./make-wrapper {};
|
||||
|
@ -26,16 +26,5 @@ in lib.optionalAttrs stdenv.hostPlatform.isLinux (
|
||||
fileSystems."/".device = "/dev/null";
|
||||
}).toplevel;
|
||||
|
||||
nixosTest-test = pkgs.testers.nixosTest ({ lib, pkgs, figlet, ... }: {
|
||||
name = "nixosTest-test";
|
||||
nodes.machine = { pkgs, ... }: {
|
||||
system.nixos = dummyVersioning;
|
||||
environment.systemPackages = [ pkgs.hello figlet ];
|
||||
};
|
||||
testScript = ''
|
||||
machine.succeed("hello | figlet >/dev/console")
|
||||
'';
|
||||
});
|
||||
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user