mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
b3de22483c
This is a decomposition of the testing-python.nix and build-vms.nix files into modules. By refactoring the glue, we accomplish the following: - NixOS tests can now use `imports` and other module system features. - Network-wide test setup can now be reusable; example: - A setup with all VMs configured to use a DNS server - Split long, slow tests into multiple tests that import a common module that has most of the setup. - Type checking for the test arguments - (TBD) "generated" options reference docs - Aspects that had to be wired through all the glue are now in their own files. - Chief example: interactive.nix. - Also: network.nix In rewriting this, I've generally stuck as close as possible to the existing code; copying pieces of logic and rewiring them, without changing the logic itself. I've made two exceptions to this rule - Introduction of `extraDriverArgs` instead of hardcoded interactivity logic. - Incorporation of https://github.com/NixOS/nixpkgs/pull/144110 in testScript.nix. I might revert the latter and split it into a new commit.
25 lines
661 B
Nix
25 lines
661 B
Nix
{ config, options, lib, ... }:
|
|
let
|
|
inherit (lib) mkIf mkOption types;
|
|
in
|
|
{
|
|
# This needs options.warnings, which we don't have (yet?).
|
|
# imports = [
|
|
# (lib.mkRenamedOptionModule [ "machine" ] [ "nodes" "machine" ])
|
|
# ];
|
|
|
|
options = {
|
|
machine = mkOption {
|
|
internal = true;
|
|
type = types.raw;
|
|
};
|
|
};
|
|
|
|
config = {
|
|
nodes = mkIf options.machine.isDefined (
|
|
lib.warn
|
|
"In test `${config.name}': The `machine' attribute in NixOS tests (pkgs.nixosTest / make-test-python.nix / testing-python.nix / makeTest) is deprecated. Please set the equivalent `nodes.machine'."
|
|
{ inherit (config) machine; }
|
|
);
|
|
};
|
|
}
|