-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
pkgs.nixosTests doesn't make sense #50301
Comments
@roberth This, theoretically, should have been solved in the refactoring at #50233. It looks like it didn't actually. The issue is that it is kind of required for usage in I must say I am not sure what |
This is where NixOS gets its Nixpkgs, unless I've had another look at the actual tests that would break if we set
(1) and (2) can be fixed easily. (3) is a bit trickier. What I'd like to do is make sure that Regarding the implementation, we can: a. Make I'm in favor of (b). Appendix:
|
Thank you for your investigation!
|
So we can disable the 'unfree' tests, with the method of disabling depending on the outcome of your question what license these tests should be considered as having.
The solutions for fixing the actual machines in the tests are provided by (1), (2) and the paragraph above.
The test definitions themselves (such as
Your analysis seems correct and what you suggest is roughly what needs to be done in PlansI'm a little busy, but I'll try to make a PR for this soon. If you feel like improving the "top-level" Nixpkgs and NixOS interfaces, have a look at #49765 in the meantime ;) Future use in NixOS jobs?(Skip this for now) |
I didn't even know this was a thing, and I think As for ofborg, we could provide builds and tests for unfree software since no caches are redistributed. However there are some ideas on doing that for debugging purposes so for now it's best not to diverge too much from hydra in terms of what we build and how we evaluate IMHO. |
@roberth Sounds great, thank you! About the way NixOS calls I think we totally agree that For all these, re-using the already-existing But this doesn't prevent keeping the dual-interface |
I'm not familiar with how it works now. But not having the module system import nixpkgs means what you're testing is not what actually happens, so what are you testing at that point? That said I do agree evaluation time is important, given how expensive this has become over time. |
So the idea is: you need to test what actually happens, but with which The objective is:
Before 83b27f6 there were two imports of Does that sound good to you? :) |
Why do we even have nixosTests to begin with? It seems like it violates the separation between nixos and nixpkgs. If you want to have a reference from nixpkgs to the nixos test, why not just use a string? So you could do:
The current architecture is misguided IMO. Nixpkgs shouldn't import NixOS at all. |
@matthewbauer I totally agree with you that Nixpkgs shouldn't need to import NixOS at all. But it's all we have until something like #36842 lands, to be able to have at least a way to link from packages to some tests that show they're non-broken. The end-goal of (Note: you can see an example of And then Also, BTW, your example doesn't tie Nixpkgs less to NixOS: nix is a lazy language, and a string that refers to a path is not particularly less bad that an import of that path, so long as the import is not used… and if it's used, then the string would have been imported anyway, so it's just as much of an import. TL;DR: I totally agree we shouldn't need to import nixos into nixpkgs, but it's the least bad option we've got to be able to automatically run tests for the time being. |
Closing in favor of #55798 |
I forgot about |
@Ericson2314 The relation "has integration test" is indeed the opposite of "tests" and "depends", regardless of which software we're discussing. As such, it seems fair to say that this complexity (lack of an architectural rule) is part of the domain ie intrinsic complexity. So I don't think we have to give up on Fixing this problem is just a matter of having nixpkgs inject itself into the nixos tests and the packages injecting themselves into the test config. The latter can be done after #119942. It seems that I've assumed wrongly before about
This is clearly not the case (anymore?). This can be done. |
Issue description
While convenient,
pkgs.nixosTests
has surprising behavior. For example, this should fail, but it doesn't:So what is wrong here, is that the NixOS tests do not use the
pkgs
that they are passed. The NixOS tests assume that they can call Nixpkgs however they want. Although not a requirement for all tests, this means that in general the tests must reinvoke Nixpkgs, thus ignoring the Nixpkgs where.nixosTest
was defined.The documentation doesn't explain this ("Push NixOS tests inside the fixed point", which is misleading at best) and the implementation of
nixosTests
looks just fine, passingpkgs
along as one would expect when reusing Nixpkgs for some tests. However, that is not what happens.pkgs
will only be used to getqemu
,lib
, probablyperl
and perhaps some other things.Why this is a problem: someone will use it to test whether NixOS, as built with their company overlay, still works. They will get false positives.
Steps to reproduce
Watch it succeed. It shouldn't.
Solutions
Ideally, we would pass
pkgs
to the NixOS machines. This can be done for some tests, but not for all the NixOS tests, because many depend onconfig.nixpkgs.config
, which is unsupported byconfig.nixpkgs.pkgs
(which is how you inject an existing Nixpkgs invocation).So I don't see a way to make this work as one might predict. I suggest deleting
pkgs.nixosTests
.@Ekleog do we really need this? It seems like just a convenience attribute.
The text was updated successfully, but these errors were encountered: