about summary refs log tree commit diff
path: root/nixos/tests/switch-test.nix
AgeCommit message (Collapse)AuthorFilesLines
2024-05-10nixos/switch-to-configuration: add new implementationJared Baur1-1/+6
This adds an implementation of switch-to-configuration that allows for closer interaction with the lifecycle of systemd units by using DBus APIs directly instead of using systemctl. It is disabled by default, but can be enabled by specifying `{ system.switch = { enable = false; enableNg = true; }; }`.
2024-04-29nixos/switch-to-configuration: fix dbus implementation used for testJared Baur1-8/+13
Makes the switch-test work with both dbus server implementations.
2024-04-06nixos/tests/switch-test: s/dbus.service/dbus-broker.service/gK9001-8/+8
Fixes the test after the default DBus implementation change.
2023-09-22nixos/switchTest: Also test swap devicesJanne Heß1-0/+24
2023-09-22nixos/switch-to-configuration: Never unmount / or /nixJanne Heß1-0/+69
Also adds a huge test for fstab handling
2023-09-13nixos/switchTest: Also test restarting from aborted switchesJanne Heß1-0/+7
2023-09-13nixos/switchTest: Also test systemd restartsJanne Heß1-0/+9
2023-09-13nixos/switchTest: Also test init interface versionJanne Heß1-1/+9
2023-09-13nixos/switch-to-configuration: Test more action thingsJanne Heß1-0/+5
2023-08-21nixos/stc: Improve mount unit handlingJanne Heß1-2/+27
We should sometimes restart the units rather than reloading them so the changes are actually applied. / and /nix are explicitly excluded because there was some very old issue where these were unmounted. I don't think this will affect many people since most people use fstab mounts instead but I plan to adapt this behavior for fstab mounts as well in the future (once I wrote a test for the fstab thingies).
2023-08-13nixos/switchTest: Also check for base unit modificationsJanne Heß1-0/+32
2023-07-23nixos/switch-to-configuration: fix ignoring of template unit specialization ↵oddlama1-9/+121
dropins
2023-06-28nixos: Add system.activatable flag for images that are pre-activatedRobert Hensing1-4/+37
2023-06-28nixos/tests/switch-test.nix: Fix warningsRobert Hensing1-3/+3
2022-08-20nixos/switch-test: add test for services starting with dashWeathercold1-1/+38
Ensures that services starting with dash can be reloaded.
2022-03-20nixos/switchTest: Also test boot/switch actionsJanne Heß1-0/+26
2022-03-20nixos/switchTest: Also test the os-release parserJanne Heß1-0/+4
2022-03-11nixos/switch-to-configuration: Fix reloading of stopped servicesJanne Heß1-0/+59
2022-03-11nixos/switch-to-configuration: Ignore some unit keysJanne Heß1-0/+14
Some unit keys don't need to restart the service to make them effective. Reduce the amount of service restarts by ignoring these keys
2022-03-11nixos/switchTest: Also test targetsJanne Heß1-0/+74
2022-03-03nixos/switchTest: Make checks more preciseJanne Heß1-35/+20
2022-03-03nixos/switch-to-configuration: Document and test socket-activated servicesJanne Heß1-2/+141
2022-02-26nixosTests.switchTest: fix race condition on /testpathNaïm Favier1-0/+2
Currently the test-watch.service gets started in a loop as long as /testpath exists, so `rm /testpath /testpath-modified` runs into a race condition where if the service was just getting activated, it will create /testpath-modified and make the test fail. This is fixed by making the service RemainAfterExit so that it only starts once, and stopping it manually after we remove /testpath.
2022-02-17nixos/switch-to-configuration: Fix backslashes in unit namesJanne Heß1-0/+36
systemd needs this so special characters (like the ones in wireguard units that appear because they are part of base64) can be escaped using the \x syntax. Root of the issue is that `glob()` handles the backslash internally which is obviously not what we want here. Also add a test case and fix some perlcritic issues in the subroutine.
2022-02-09nixos/switch-test: Test the unit file parser and reloadsJanne Heß1-6/+241
2022-01-20nixos/switch-to-configuration: Clean up lower part of the scriptJanne Heß1-2/+77
- Fully get rid of `parseKeyValues` and use systemctl features for that - Add some regex modifiers recommended by perlcritic - Get rid of a postfix if - Sort units when showing their status - Clean the logic for showing what failed from `elif` to `next` - Switch from `state` to `substate` for `auto-restart` because that's actually where the value is stored - Show status of units with one single systemctl call and get rid of COLUMNS in favor of --full - Add a test for failing units
2022-01-17nixos/switch-to-configuration: Rework activation script restartsJanne Heß1-0/+70
This removes `/run/nixos/activation-reload-list` (which we will need in the future when reworking the reload logic) and makes `/run/nixos/activation-restart-list` honor `restartIfChanged` and `reloadIfChanged`. This way activation scripts don't have to bother with choosing between reloading and restarting.
2021-12-09nixos/switchTest: Massively extend the testJanne Heß1-5/+296
2021-11-27Revert "Merge pull request #141192 from ↵Michael Weiss1-383/+3
helsinki-systems/feat/improved-socket-handling2" This reverts commit 57961d2b838cc31fa4ce89641b6a8db544a8471a, reversing changes made to b04f913afce4419f6b777fd64ac52315dbef3aaf. (I.e. this reverts PR #141192.) While well-intended, this change does unfortunately introduce very serious regressions that are especially disruptive/noticeable on desktop systems (e.g. users of Sway will loose their graphical session when running "nixos-rebuild switch"). Therefore, this change has to be reverted ASAP instead of trying to fix it in "production". Note: An updated version should be extensively discussed, reviewed, and tested before re-landing this change as an earlier version also had to be reverted for the exact same issues [0]. Fix: #146727 [0]: https://github.com/NixOS/nixpkgs/pull/73871#issuecomment-559783752
2021-10-28nixos/switchTest: Make less flakeyJanne Heß1-1/+2
2021-10-17nixos/switchTest: Also test mountsJanne Heß1-0/+44
2021-10-17nixos/switch-to-configuration: Restart timersJanne Heß1-0/+36
2021-10-17nixos/switch-to-configuration: Ignore path unitsJanne Heß1-0/+36
2021-10-17nixos/switch-to-configuration: Ignore slice unitsJanne Heß1-0/+34
2021-10-17nixos/switch-to-configuration: Improve socket supportJanne Heß1-3/+232
This commit changes a lot more that you'd expect but it also adds a lot of new testing code so nothing breaks in the future. The main change is that sockets are now restarted when they change. The main reason for the large amount of changes is the ability of activation scripts to restart/reload units. This also works for socket-activated units now, and honors reloadIfChanged and restartIfChanged. The two changes don't really work without each other so they are done in the one large commit. The test should show what works now and ensure it will continue to do so in the future.
2021-01-10treewide: simplify pkgs.stdenv.lib -> pkgs.libDominik Xaver Hörl1-1/+1
The library does not depend on stdenv, that `stdenv` exposes `lib` is an artifact of the ancient origins of nixpkgs.
2020-04-07treewide: use runtimeShell in nixos/Jörg Thalheim1-1/+1
This is needed for cross-compilation.
2019-12-15nixosTests.switch-test: Port tests to pythonChristian Kampka1-3/+7
2019-02-14nixos/tests/switch-test: Ensures the test fails on failure (#55744)Samuel Dionne-Riel1-2/+11
The `| tee` invocation always masked the return value of the switch-to-configuration test. ``` ~ $ false | tee && echo "oh no" oh no ``` The added wrapper script will still output everything to stderr, while passing failures to the test harness.
2018-07-20[bot] nixos/*: remove unused arguments in lambdasvolth1-2/+2
2017-11-19nixos/system: make switch-to-configuration script pure.Gleb Peregud1-0/+25
Fixes #28443 Fixed few invocations to `systemctl` to have an absolute path. Additionally add LOCALE_ARCHIVE so that perl stops spewing warning messages.