Commit Graph

17 Commits

Author SHA1 Message Date
Janne Heß
1c1f8c59e1
nixos/switch-test: Test the unit file parser and reloads 2022-02-09 15:14:38 +01:00
Janne Heß
b52372675d
nixos/switch-to-configuration: Clean up lower part of the script
- 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-20 17:10:02 +01:00
Janne Heß
2cf157c781
nixos/switch-to-configuration: Rework activation script restarts
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.
2022-01-17 17:57:23 +01:00
Janne Heß
efcdc01d62
nixos/switchTest: Massively extend the test 2021-12-09 12:30:48 +01:00
Michael Weiss
1cfecb636b
Revert "Merge pull request #141192 from 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-11-27 17:22:22 +01:00
Janne Heß
c2bdad7ab6
nixos/switchTest: Make less flakey 2021-10-28 11:51:21 +02:00
Janne Heß
720571eefa
nixos/switchTest: Also test mounts 2021-10-17 14:35:47 +02:00
Janne Heß
4f870c7d70
nixos/switch-to-configuration: Restart timers 2021-10-17 14:35:47 +02:00
Janne Heß
adc033cd59
nixos/switch-to-configuration: Ignore path units 2021-10-17 14:35:46 +02:00
Janne Heß
de128feacc
nixos/switch-to-configuration: Ignore slice units 2021-10-17 14:35:46 +02:00
Janne Heß
cfad5e3403
nixos/switch-to-configuration: Improve socket support
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-10-17 14:35:43 +02:00
Dominik Xaver Hörl
25bef2d8f9 treewide: simplify pkgs.stdenv.lib -> pkgs.lib
The library does not depend on stdenv, that `stdenv` exposes `lib` is
an artifact of the ancient origins of nixpkgs.
2021-01-10 20:12:06 +01:00
Jörg Thalheim
cf3328e7e3
treewide: use runtimeShell in nixos/
This is needed for cross-compilation.
2020-04-07 07:26:47 +01:00
Christian Kampka
aeeabe0b89
nixosTests.switch-test: Port tests to python 2019-12-15 18:22:35 +01:00
Samuel Dionne-Riel
98419a0f64 nixos/tests/switch-test: Ensures the test fails on failure (#55744)
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.
2019-02-14 22:55:16 +01:00
volth
2e979e8ceb [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
Gleb Peregud
2f6148c743 nixos/system: make switch-to-configuration script pure.
Fixes #28443

Fixed few invocations to `systemctl` to have an absolute path. Additionally add
LOCALE_ARCHIVE so that perl stops spewing warning messages.
2017-11-19 19:42:54 +01:00