nixos/testing-python: Avoid infinite recursion in node definitions#144110
Draft
talyz wants to merge 1 commit intoNixOS:masterfrom
Draft
nixos/testing-python: Avoid infinite recursion in node definitions#144110talyz wants to merge 1 commit intoNixOS:masterfrom
talyz wants to merge 1 commit intoNixOS:masterfrom
Conversation
Pass a version of the nodes without `additionalPaths` to `testScript` in order to avoid infinite recursion when the test script refers to any of the nodes' toplevel closures.
roberth
reviewed
Nov 9, 2021
| mkTestScript = qemu_pkg: | ||
| # Call the test script with the computed nodes. | ||
| if lib.isFunction testScript | ||
| then testScript { nodes = nodes qemu_pkg false; } |
Member
There was a problem hiding this comment.
Suggested change
| then testScript { nodes = nodes qemu_pkg false; } | |
| # To avoid an infinite recursion (nodes -> testScript -> nodes), we force disable | |
| # the effect of config.virtualisation.useNixStoreImage, so `testScript -> nodes` | |
| # becomes `testScript -> nodes2` where `nodes2` does not reference the `testScript`. | |
| then testScript { nodes = nodes qemu_pkg false; } |
roberth
reviewed
Nov 9, 2021
Comment on lines
+245
to
+249
| inherit enableOCR skipLint passthru; | ||
| testScript = mkTestScript pkgs.qemu_test; | ||
| testName = name; | ||
| qemu_pkg = pkgs.qemu_test; | ||
| nodes = nodes pkgs.qemu_test; | ||
| nodes = nodes pkgs.qemu_test true; |
Member
There was a problem hiding this comment.
It would be best if the testScript could reuse this nodes value instead; only invoking the configs an extra time, when lib.any (n: n.config.virtualisation.useNixStoreImage) nodes.
33 tasks
Member
|
I've translated this PR's logic into part of a module in #176557, |
roberth
added a commit
to hercules-ci/nixpkgs
that referenced
this pull request
Jun 15, 2022
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 NixOS#144110
in testScript.nix.
I might revert the latter and split it into a new commit.
roberth
added a commit
to hercules-ci/nixpkgs
that referenced
this pull request
Jun 21, 2022
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 NixOS#144110
in testScript.nix.
I might revert the latter and split it into a new commit.
roberth
added a commit
to hercules-ci/nixpkgs
that referenced
this pull request
Jun 27, 2022
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 NixOS#144110
in testScript.nix.
I might revert the latter and split it into a new commit.
roberth
added a commit
to hercules-ci/nixpkgs
that referenced
this pull request
Jun 28, 2022
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 NixOS#144110
in testScript.nix.
I might revert the latter and split it into a new commit.
roberth
added a commit
that referenced
this pull request
Sep 17, 2022
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 #144110
in testScript.nix.
I might revert the latter and split it into a new commit.
roberth
added a commit
to hercules-ci/nixpkgs
that referenced
this pull request
Sep 21, 2022
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 NixOS#144110
in testScript.nix.
I might revert the latter and split it into a new commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for this change
This is a follow-up to #140792 and #144014.
#144014 solves the infinite recursion issue when
useNixStoreImageisfalse. This follow-up solves it in the general case by passing a version of the nodes withoutadditionalPathstotestScript.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)