Conversation
2d0af0b to
c11f55b
Compare
|
Thanks for the ping, I will review this when I have some time. |
c11f55b to
9cc5158
Compare
cfd5632 to
a60ee70
Compare
a60ee70 to
b183dc0
Compare
|
I've applied this to two tests and packages I maintain, which led me to develop the This has increased the diff size a fair bit, but most of the changes to the two packages are trivial. The commit history also shows the non- Tested happy flow with: (set -x; for package in cassandra_4 ghostunnel; do for system in x86_64-linux aarch64-darwin; do nix-build -A $package.tests.nixos --argstr system $system; nix-build -A nixosTests.$package --argstr system $system; done; done)Tested expected error with: nix-repl> with import ./. { system = "aarch64-darwin"; }; (ghostunnel.overrideAttrs { name = "yolotunnel"; }).tests.nixos<snip> |
nixos/lib/testing/call-test.nix
Outdated
There was a problem hiding this comment.
This could work well for the callPackageWith case, too.
nixos/lib/testing/run.nix
Outdated
There was a problem hiding this comment.
Not sure about the name.. but I needed "override existing option" already as well, when prototyping a module-based system argument for #402298 (comment). Good thing.
There was a problem hiding this comment.
Ah, this will probably also help with nixosTests.postgresql, which currently is a matrix of tests for each major version.
Maybe we can then just have nixosTests.postgresql be the tests for v17 (latest) and the other versions are tested via passthru only.
There was a problem hiding this comment.
Some back & forth between commits with formatting of ghostunnel here. Looking at the commit messages, I assume you don't want to squash this, so this should be cleaned up.
There was a problem hiding this comment.
setPackage is odd to me. I would expect it to be called overridePackage, that's what it does, right? Aka, without setPackage I still get a test with the default package?
Although the whole thing... looks a lot like there is a test function which needs a package argument, which has a default value. On the nixpkgs-side, that's just .override { package = finalAttrs.finalPackage; }. I see similarity to what .callPackage does, here. But callPackage does it for many packages, more generalized.
Can this be generalized, too?
There was a problem hiding this comment.
The tests aren't callPackage-based anymore, to simplify two "dependency injectors" into just one, which is the module system with its module arguments.
setPackage "takes" that general functionality and narrows it down to a single use case in a way that supports running the tests on macOS VM hosts. And it tries to do so in a developer friendly way, with a workaround for a common error scenario and a descriptive error when the combination of features (overriding and cross-platform passthru tests) is not supported.
So the easy answer is it doesn't need to be generalized. Contributors can use module arguments or options directly.
OTOH yes, it could be generalized to support multiple packages at once.
|
I'm not so jsure that the way we run NixOS tests on VM hosts like darwin is the right way. Perhaps the Should I remove the |
|
I don't claim to understand the details and implications of this, but I think one important property for nixpkgs-review is to be able to build the same |
|
Right. At least
The latter is more correct, manages expectations better, doesn't lead to subtle impossibilities, and keeps our "infra code" simpler, but it does burden the package authors and the |
|
I've split out the first part into |
OK, I'm starting to understand the problem space a bit more...
The whole point of enabling Thus,
Can we maybe make this part of what's currently called Aka, turns this function into a "do everything that needs to be done to run this test via pkg.passthru.tests sensibly". Set the right package, return an empty attrset for darwin, .. maybe something else (in the future). |
Unfortunately this |
I don't understand why it needs to be in |
Tested with
(ghostunnel.overrideAttrs { name = "yolotunnel"; }).tests.nixos
and
nix-store -q --tree
Also it builds just fine, fwiw.
This file simplifies configuring the test with a specific package, for those tests where overriding involves a single package. This improves the cassandra test by recovering the passthru test on Darwin.
ed53fbb to
ef1589d
Compare
|
Alternative direction: (also independently useful, I'd say) |
|
I'd say it's not really an alternative, both are orthogonal. I think we'd want both:
|
Description of changes
Add overriding methods to the NixOS test package attrset.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.