-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[backport 2.3] Allow testing with different daemons #5650
base: 2.3-maintenance
Are you sure you want to change the base?
[backport 2.3] Allow testing with different daemons #5650
Commits on Oct 31, 2023
-
Actually test nix-env with a remote store
The `remote-store` test loads the `user-env` one to test nix-env when using the daemon, but actually does it incorrectly because every test starts (in `common.sh`) by resetting the value of `NIX_REMOTE`, meaning that the `user-env` test will never use the daemon. Fix this by setting `NIX_REMOTE_` before sourcing `user-env.sh` in the `remote-store` test, so that `NIX_REMOTE` is correctly set inside the test (cherry picked from commit f6ac888)
Configuration menu - View commit details
-
Copy full SHA for 7ec64b5 - Browse repository at this point
Copy the full SHA 7ec64b5View commit details -
Add a test ensuring compatibility with an old daemon
This requires adding `nix` to its own closure which is a bit unfortunate, but as it is optional (the test will be disabled if `OUTER_NIX` is unset) it shouldn't be too much of an issue. (Ideally this should go in another derivation so that we can build Nix and run the test independently, but as the tests are running in the same derivation as the build it's a bit complicated to do so). (cherry picked from commit 5716345)
Configuration menu - View commit details
-
Copy full SHA for 22482a0 - Browse repository at this point
Copy the full SHA 22482a0View commit details -
Make the tests (optionnally) run in another derivation
That way we can run them without rebuilding Nix (cherry picked from commit a0866c8)
Configuration menu - View commit details
-
Copy full SHA for 4ffbede - Browse repository at this point
Copy the full SHA 4ffbedeView commit details -
Allow running all the tests with the daemon
When `NIX_DAEMON_PACKAGE` is set, make all the tests use the Nix daemon. That way we can test every piece of Nix functionality both with and without the daemon. Tests for which using the daemon isn’t possible or doesn’t make sens can selectively be disabled with `needLocalStore` (cherry picked from commit addacfc)
Configuration menu - View commit details
-
Copy full SHA for ab862b7 - Browse repository at this point
Copy the full SHA ab862b7View commit details -
Remove the right socket before starting the daemon
For some reason, an old socket occasionally stays here on OSX, causing the subsequent tests to fail (cherry picked from commit c2c0dba)
Configuration menu - View commit details
-
Copy full SHA for cf67f7a - Browse repository at this point
Copy the full SHA cf67f7aView commit details -
mk/tests.mk: document 'installcheck' in 'make help'
(cherry picked from commit 1e6faa7)
Configuration menu - View commit details
-
Copy full SHA for 366d01c - Browse repository at this point
Copy the full SHA 366d01cView commit details -
- Don’t hardcode the “newer” version - Remove an ill-placed `return` (cherry picked from commit 3a2fc9c)
Configuration menu - View commit details
-
Copy full SHA for a495667 - Browse repository at this point
Copy the full SHA a495667View commit details -
Make the post-build-hook use the daemon Nix package
Having the `post-build-hook` use `nix` from the client package can lead to a deadlock in case there’s a db migration to do between both, as a `nix` command running inside the hook will run as root (and as such will bypass the daemon), so might trigger a db migration, which will get stuck trying to get a global lock on the DB (as the daemon that ran the hook already has a lock on it). (cherry picked from commit 93eadd5)
Configuration menu - View commit details
-
Copy full SHA for e693190 - Browse repository at this point
Copy the full SHA e693190View commit details -
The eventual PATH entry needs the `.../bin` or we will not use the right daemon. (cherry picked from commit 06fb6ae)
Configuration menu - View commit details
-
Copy full SHA for cee4cb6 - Browse repository at this point
Copy the full SHA cee4cb6View commit details -
Flip condition on daemon version for structured attrs
We want the old behavior, since this is Nix 2.3.
Configuration menu - View commit details
-
Copy full SHA for bc28776 - Browse repository at this point
Copy the full SHA bc28776View commit details -
tests: Add command source locations to test log
(cherry picked from commit 9813e54)
Configuration menu - View commit details
-
Copy full SHA for ddb78e1 - Browse repository at this point
Copy the full SHA ddb78e1View commit details -
Tighten up the
exportReferencesGraph
testsAdd an `$` at the end of the `grep` regex. Without it, `checkRef foo` would always imply `checkRef foo.drv`. We want to tell these situations apart to more precisely test what is going on. (cherry picked from commit f587598)
Configuration menu - View commit details
-
Copy full SHA for 4c1441a - Browse repository at this point
Copy the full SHA 4c1441aView commit details -
Make init.sh safe to run twice
(cherry picked from commit 5dbbf23)
Configuration menu - View commit details
-
Copy full SHA for 0fe5dcb - Browse repository at this point
Copy the full SHA 0fe5dcbView commit details -
Use `set -u` and `set -o pipefail` to catch accidental mistakes and failures more strongly. - `set -u` catches the use of undefined variables - `set -o pipefail` catches failures (like `set -e`) earlier in the pipeline. This makes the tests a bit more robust. It is nice to read code not worrying about these spurious success paths (via uncaught) errors undermining the tests. Indeed, I caught some bugs doing this. There are a few tests where we run a command that should fail, and then search its output to make sure the failure message is one that we expect. Before, since the `grep` was the last command in the pipeline the exit code of those failing programs was silently ignored. Now with `set -o pipefail` it won't be, and we have to do something so the expected failure doesn't accidentally fail the test. To do that we use `expect` and a new `expectStderr` to check for the exact failing exit code. See the comments on each for why. `grep -q` is replaced with `grepQuiet`, see the comments on that function for why. `grep -v` when we just want the exit code is replaced with `grepInverse, see the comments on that function for why. `grep -q -v` together is, surprise surprise, replaced with `grepQuietInverse`, which is both combined. (cherry picked from commit c118361)
Configuration menu - View commit details
-
Copy full SHA for 0435ae9 - Browse repository at this point
Copy the full SHA 0435ae9View commit details