aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2023-07-25Add `parseFlakeRef` and `flakeRefToString` builtins (#8670)Alex Ameen
Over the last year or so I've run into several use cases where I need to parse and/or serialize URLs for use by `builtins.fetchTree` or `builtins.getFlake`, largely in order to produce _lockfile-like_ files for lang2nix frameworks or tools which use `nix` internally to drive builds. I've gone through the painstaking process of emulating `nix::FlakeRef::fromAttrs` and `nix::parseFlakeRef` several times with mixed success; but these are difficult to create and even harder to maintain if I hope to stay aligned with changes to the real parser/serializer. I understand why adding new `builtins` isn't something we want to do flagrantly. I'm recommending this addition simply because I keep encountering use cases where I need to parse/serialize these URIs in `nix` expressions, and I want a reliable solution. Co-authored-by: Eelco Dolstra <edolstra@gmail.com> Co-authored-by: John Ericson <git@JohnEricson.me>
2023-07-21parser: merge nested dynamic attributesNaïm Favier
Fixes https://github.com/NixOS/nix/issues/7115
2023-07-19Merge pull request #8680 from NixLayeredStore/test-groupsJohn Ericson
Introduce notion of a test group, use for CA tests
2023-07-18Merge pull request #8506 from corngood/ssh-masterRobert Hensing
Pass NIX_SSHOPTS when checking for an ssh master connection.
2023-07-18Introduce notion of a test group, use for CA testsJohn Ericson
Grouping our tests should make it easier to understand the intent than one long poorly-arranged list. It also is convenient for running just the tests for a specific component when working on that component. We need at least one test group so this isn't dead code; I decided to collect the tests for the `ca-derivations` and `dynamic-derivations` experimental features in groups. Do ```bash make ca.test-group -jN ``` and ```bash make dyn-drv.test-group -jN ``` to try running just them. I originally did this as part of #8397 for being able to just the local overlay store alone. I am PRing it separately now so we can separate general infra from new features. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-07-17Merge pull request #8342 from NixLayeredStore/best-effort-supplementary-groupsThéophane Hufschmitt
Best effort supplementary groups
2023-07-14Test nested sandboxing, and make nicer errorJohn Ericson
We were bedeviled by sandboxing issues when working on the layered store. The problem ended up being that when we have nested nix builds, and the inner store is inside the build dir (e.g. store is `/build/nix-test/$name/store`, build dir is `/build`) bind mounts clobber each other and store paths cannot be found. After thoroughly cleaning up `local-derivation-goal.cc`, we might be able to make that work. But that is a lot of work. For now, we just fail earlier with a proper error message. Finally, test this: nested sandboxing without the problematic store dir should work, and with should fail with the expected error message. Co-authored-by: Dylan Green <67574902+cidkidnix@users.noreply.github.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-13move unset NIX_STORE_DIR in supplementary-groups.shcidkidnix
to inside the unshare
2023-07-13Add comment regarding the unset of NIX_STORE_DIRcidkidnix
in build-remote.sh and supplementary-groups.sh
2023-07-13Revert "Skip build-remote-trustless unless sandbox is supported."John Ericson
This reverts commit 41412dc4ae0fec2d08335c19724276d99e0c6056.
2023-07-13Revert "Check _NIX_TEST_NO_SANDBOX when setting _canUseSandbox."John Ericson
This reverts commit c1d39de1fbceebbb6b46abc4a21fb8e34423df99.
2023-07-13Merge remote-tracking branch 'upstream/master' into ↵John Ericson
best-effort-supplementary-groups
2023-07-13Fix race condition in the language testsJohn Ericson
When we pipe to `>(...)` like that, we unfortunately don't wait for the process to finish. Better to just substitute the file. Also, use the "unified" diff output that people (including myself) are more familiar with, thanks to Git.
2023-07-11Expanded test suiteMathnerd314
* Lang now verifies errors and parse output * Some new miscellaneous tests * Easy way to update the tests * Document workflow in manual * Use `!` not `~` as separater char for sed It is confusing to use `~` when we are talking about paths and home directories! * Test test suite itself (`test/lang-test/infra.sh`) Additionally, run shellcheck on `tests/lang.sh` to help ensure it is correct, now that is is more complex. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-07-11Skip build-remote-trustless unless sandbox is supported.Ben Radford
2023-07-11Check _NIX_TEST_NO_SANDBOX when setting _canUseSandbox.Ben Radford
2023-07-11Always attempt setgroups but allow failure to be ignored.Ben Radford
2023-07-11Merge remote-tracking branch 'origin/master' into ↵Ben Radford
best-effort-supplementary-groups
2023-07-10Fix test file nameJohn Ericson
It's UTF-8, not UFT-8.
2023-07-09Merge pull request #8370 from hercules-ci/fetchClosure-input-addressedJohn Ericson
`fetchClosure`: input addressed and pure
2023-07-07signing.sh: Revert test improvement because it fails on GHA + macOSRobert Hensing
2023-07-03Fix testEelco Dolstra
2023-06-30tests: Don't install test-libstoreconsumer programRobert Hensing
Sorry about that. Fixes https://github.com/NixOS/nix/issues/8616
2023-06-30tests/signing.sh: Check signature checking error messageRobert Hensing
We should check error messages, so that we know the command fails for the right reason. Alternatively, a mere typo can run the test undetected.
2023-06-30tests/fetchClosure: Improve coverage of new and some existing flowsRobert Hensing
2023-06-30fetchClosure: Docs and error message improvementsRobert Hensing
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-30fetchClosure: Allow input addressed paths in pure modeRobert Hensing
When explicitly requested by the caller, as suggested in the meeting (https://github.com/NixOS/nix/pull/8090#issuecomment-1531139324) > @edolstra: { toPath } vs { fromPath } is too implicit I've opted for the `inputAddressed = true` requirement, because it we did not agree on renaming the path attributes. > @roberth: more explicit > @edolstra: except for the direction; not immediately clear in which direction the rewriting happens This is in fact the most explicit syntax and a bit redundant, which is good, because that redundancy lets us deliver an error message that reminds expression authors that CA provides a better experience to their users.
2023-06-30Merge pull request #8589 from jfroche/sign-paths-as-allowed-userEelco Dolstra
Allow to sign path as unprivileged user
2023-06-27Allow to sign path as unprivileged userJean-François Roche
User can now sign path as unprivileged/allowed user refs #1708
2023-06-27nix flake check: improve error message if overlay is not a lambda (#8582)Maximilian Bosch
* nix flake check: improve error message if overlay is not a lambda Suppose you have an overlay like this { inputs = { /* ... */ }; outputs = { flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: { overlays.default = final: prev: { }; }); } then `nix flake check` (correctly) fails because `overlays` are supposed to have the structure `overlays.<name> = final: prev: exp`. However, the error-message is a little bit counter-intuitive: error: overlay does not take an argument named 'final' While one might guess where the error actually comes from because the trace above says `… while checking the overlay 'overlays.x86_64-linux'` this is still pretty confusing because it complains about an argument not being named `final` even though that's evidently the case. With this change, the error-message actually makes it clear what's wrong: [ma27@carsten:~/Projects/nix/tmp]$ nix flake check --extra-experimental-features 'nix-command flakes' path:$(pwd) error: … while checking flake output 'overlays' at /nix/store/clgblnxx003hyrq8qkz5ab6kgqkck6qc-source/flake.nix:4:5: 3| outputs = { ... }: { 4| overlays.x86_64-linux.snens = final: prev: { | ^ 5| kek = throw "snens"; … while checking the overlay 'overlays.x86_64-linux' at /nix/store/clgblnxx003hyrq8qkz5ab6kgqkck6qc-source/flake.nix:4:5: 3| outputs = { ... }: { 4| overlays.x86_64-linux.snens = final: prev: { | ^ 5| kek = throw "snens"; error: overlay is not a lambda, but a set instead
2023-06-24Merge pull request #5385 from Enzime/add/dirty-revThéophane Hufschmitt
Add `dirtyRev` and `dirtyShortRev` to `fetchGit`
2023-06-24Add `dirtyRev` and `dirtyShortRev` to `fetchGit`Michael Hoang
Fixes #4682
2023-06-22Better document build failure exit codesJohn Ericson
- Improved API docs from comment - Exit codes are for `nix-build`, not just `nix-store --release` - Make note in tests so the magic numbers are not surprising Picking up where #8387 left off.
2023-06-22Merge pull request #8387 from layus/fix-testsJohn Ericson
Check exact error codes in linux-sandbox.sh
2023-06-20Update tests/linux-sandbox.shGuillaume Maudoux
Co-authored-by: John Ericson <git@JohnEricson.me>
2023-06-20Support opening local store with database on read-only filesystem (#8356)Ben Radford
Previously it was not possible to open a local store when its database is on a read-only filesystem. Obviously a store on a read-only filesystem cannot be modified, but it would still be useful to be able to query it. This change adds a new read-only setting to LocalStore. When set to true, Nix will skip operations that fail when the database is on a read-only filesystem (acquiring big-lock, schema migration, etc), and the store database will be opened in immutable mode. Co-authored-by: Ben Radford <benradf@users.noreply.github.com> Co-authored-by: cidkidnix <cidkidnix@protonmail.com> Co-authored-by: Dylan Green <67574902+cidkidnix@users.noreply.github.com> Co-authored-by: John Ericson <git@JohnEricson.me> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-16Merge pull request #8477 from edolstra/tarball-flake-redirectsEelco Dolstra
Tarball flake improvements
2023-06-16Merge pull request #8517 from hercules-ci/fix-build-hook-error-for-lib-usersEelco Dolstra
Fix build hook error for libstore library users
2023-06-15Fix build hook error for libstore library usersRobert Hensing
A library shouldn't require changes to the caller's argument handling, especially if it doesn't have to, and indeed we don't have to. This changes the lookup order to prioritize the hardcoded path to nix if it exists. The static executable still finds itself through /proc and the like.
2023-06-15rename files referring to antiquotationValentin Gagarin
since we renamed this to string interpolation, file names should be fixed up as well
2023-06-15Merge pull request #8351 from obsidiansystems/delete-profiles-tests-docsJohn Ericson
Expanding tests and docs relating to deleting profiles
2023-06-14Split out `nix-collect-garbage -d` test to new fileJohn Ericson
Good for test parallelism, and separation of concerns (core GC vs profiles deleting).
2023-06-14Add another case to the `nix-collect-garbage -d` testJohn Ericson
2023-06-14Remove RegisterPrimOp constructor without support for documentationMichal Sojka
The remaining constructor RegisterPrimOp::RegisterPrimOp(Info && info) allows specifying the documentation in .args and .doc members of the Info structure. Commit 8ec1ba02109e removed all uses of the removed constructor in the nix binary. Here, we remove the constructor completely as well as its use in a plugin test. According to #8515, we didn't promis to maintain compatibility with external plugins. Fixes #8515
2023-06-14Merge pull request #8490 from flox/stdin_handlingJohn Ericson
fix: Do not apply default installables when using --stdin
2023-06-14Merge pull request #4803 from ShamrockLee/nix-channel-list-generationsJohn Ericson
Add `nix-channel --list-generations`
2023-06-14Merge pull request #4282 from tweag/fix-ca-hash-rewritingJohn Ericson
fix the hash rewriting for ca-derivations
2023-06-13Allow tarball URLs to redirect to a lockable immutable URLEelco Dolstra
Previously, for tarball flakes, we recorded the original URL of the tarball flake, rather than the URL to which it ultimately redirects. Thus, a flake URL like http://example.org/patchelf-latest.tar that redirects to http://example.org/patchelf-<revision>.tar was not really usable. We couldn't record the redirected URL, because sites like GitHub redirect to CDN URLs that we can't rely on to be stable. So now we use the redirected URL only if the server returns the `x-nix-is-immutable` or `x-amz-meta-nix-is-immutable` headers in its response.
2023-06-13Add test of explicit ssh control path in nix-copy testDavid McFarland
This highlights a problem caused by SSHMaster::isMasterRunning returning false when NIX_SSHOPTS contains -oControlPath.
2023-06-12test: add test for non-defaulting for stding installable inputTom Bereknyei