Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests.references: use runNixOSTest instead of nixosTest #292759

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions pkgs/build-support/trivial-builders/test/references/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,27 @@ let
};
});
in
testers.nixosTest {
name = "nixpkgs-trivial-builders";
nodes.machine = { ... }: {
testers.runNixOSTest ({ config, lib, ... }:
let
# 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;

# Test runs without network, so we don't substitute and prepare our deps
nix.settings.substituters = lib.mkForce [ ];
environment.etc."pre-built-paths".source = writeText "pre-built-paths" (
builtins.toJSON [ testScriptBin ]
);
system.extraDependencies = [ guestTestScriptBin ];
};
testScript =
''
machine.succeed("""
${lib.getExe testScriptBin} 2>/dev/console
${lib.getExe guestTestScriptBin} 2>/dev/console
""")
'';
passthru = {
Expand All @@ -114,11 +120,12 @@ testers.nixosTest {
samples
testScriptBin
;
inherit guestTestScriptBin;
};
meta = {
maintainers = with lib.maintainers; [
roberth
ShamrockLee
];
};
}
})
Loading