tests.references: migrate from nixosTest to runNixOSTest
- Use testers.runNixOSTest instead of testers.nixosTest as nixosTest has become obsolete. - Prepare for cross-platform testing. - Use the testScriptBin passthru'd by the references test package inside the guest pkgs.
This commit is contained in:
parent
9b54fb4524
commit
abf7172bfa
@ -90,21 +90,27 @@ let
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
testers.nixosTest {
|
testers.runNixOSTest ({ config, lib, ... }:
|
||||||
name = "nixpkgs-trivial-builders";
|
let
|
||||||
nodes.machine = { ... }: {
|
# Use the testScriptBin from guest pkgs.
|
||||||
|
# The attribute path to access the guest version of testScriptBin is
|
||||||
|
# tests.trivial-builders.references.config.node.pkgs.tests.trivial-builders.references.testScriptBin
|
||||||
|
# which is why passthru.guestTestScriptBin is provided.
|
||||||
|
guestTestScriptBin = config.node.pkgs.tests.trivial-builders.references.testScriptBin;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "nixpkgs-trivial-builders-references";
|
||||||
|
nodes.machine = { config, lib, pkgs, ... }: {
|
||||||
virtualisation.writableStore = true;
|
virtualisation.writableStore = true;
|
||||||
|
|
||||||
# Test runs without network, so we don't substitute and prepare our deps
|
# Test runs without network, so we don't substitute and prepare our deps
|
||||||
nix.settings.substituters = lib.mkForce [ ];
|
nix.settings.substituters = lib.mkForce [ ];
|
||||||
environment.etc."pre-built-paths".source = writeText "pre-built-paths" (
|
system.extraDependencies = [ guestTestScriptBin ];
|
||||||
builtins.toJSON [ testScriptBin ]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
testScript =
|
testScript =
|
||||||
''
|
''
|
||||||
machine.succeed("""
|
machine.succeed("""
|
||||||
${lib.getExe testScriptBin} 2>/dev/console
|
${lib.getExe guestTestScriptBin} 2>/dev/console
|
||||||
""")
|
""")
|
||||||
'';
|
'';
|
||||||
passthru = {
|
passthru = {
|
||||||
@ -114,6 +120,7 @@ testers.nixosTest {
|
|||||||
samples
|
samples
|
||||||
testScriptBin
|
testScriptBin
|
||||||
;
|
;
|
||||||
|
inherit guestTestScriptBin;
|
||||||
};
|
};
|
||||||
meta = {
|
meta = {
|
||||||
maintainers = with lib.maintainers; [
|
maintainers = with lib.maintainers; [
|
||||||
@ -121,4 +128,4 @@ testers.nixosTest {
|
|||||||
ShamrockLee
|
ShamrockLee
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user