Commit Graph

950 Commits

Author SHA1 Message Date
Raito Bezarius
d4d7550108 nixos/test-driver: provide a global timeout
Since the debut of the test-driver, we didn't obtain
a race timer with the test execution to ensure that tests doesn't run beyond
a certain amount of time.

This is particularly important when you are running into hanging tests
which cannot be detected by current facilities (requires more pvpanic wiring up, QMP
API stuff, etc.).

Two easy examples:

- Some QEMU tests may get stuck in some situation and run for more than 24 hours → we default to 1 hour max.
- Some QEMU tests may panic in the wrong place, e.g. UEFI firmware or worse → end users can set a "reasonable" amount of time

And then, we should let the retry logic retest them until they succeed and adjust
their global timeouts.

Of course, this does not help with the fact that the timeout may need to be
a function of the actual busyness of the machine running the tests.
This is only one step towards increased reliability.
2023-10-29 12:45:00 +01:00
Jacek Galowicz
dda77fcc55
Merge pull request #257535 from RaitoBezarius/vmstate
nixos/lib/test-driver: use QMP API to watch for VM state
2023-10-22 14:22:34 +01:00
Ryan Lahfa
c5442c247f
Merge pull request #257262 from dongcarl/2023-09-nginx-fixes
nixos/nginx: Allow empty port for listen directive (for unix socket)
2023-10-21 17:26:57 +01:00
Raito Bezarius
f94876a65c nixos/lib/test-driver: wire up QMP client
Now that we have a QMP client, we can wire it up in the test driver.

For now, it is almost completely useless because of the need of a constant "event loop", especially
for event listening.

In the next commits, we will slowly enable more and more usecases.
2023-10-21 13:03:15 +02:00
Philip Taron
989cca26c4
systemd.network.netdev: Add support for WLAN devices
These are virtual interface, where one physical wifi adapter can have
more than one interface.

See https://systemd.network/systemd.netdev.html#%5BWLAN%5D%20Section%20Options
and dedf2d0054
2023-10-16 15:04:44 -07:00
Robert Hensing
a14f3f829d nixos/eval-config.nix: Rename arg nixosSystem -> configuration
For some time now the attrset returned by `evalModules` has
`type = "configuration"`.

This is a clean refactor because the name is not exposed.
(never is for simple lambda)
2023-10-10 13:25:15 +02:00
Robert Hensing
1c0427862e nixos/eval-config.nix: Rename let withExtraArgs -> withExtraAttrs
Presumably it only used to add `extraArgs`, but it also adds other
attributes now.
2023-10-10 13:24:55 +02:00
Carl Dong
e5c2c71280 nixos/nginx: Allow empty port for listen directive
When listening on unix sockets, it doesn't make sense to specify a port
for nginx's listen directive.

Since nginx defaults to port 80 when the port isn't specified (but the
address is), we can change the default for the option to null as well
without changing any behaviour.
2023-10-09 21:16:03 -04:00
K900
93cfbb253c eval-config.nix: set nixpkgs.pkgs instead of _module.args.pkgs
This allows nixpkgs.overlays to work, and also the nixpkgs.config check.
2023-10-08 20:41:44 +03:00
K900
80cc25eb51 nixos/testing: fix eval for tests created without make-python-test.nix
We have too many test entrypoints and this is a problem.
2023-10-06 23:52:04 +03:00
K900
8a7282f90b nixosTest: fix tests defined with pkgs.nixosTest 2023-10-06 16:33:15 +03:00
Florian Klink
42f2e2dadd
Merge pull request #257510 from ign0tus/fix/wake-on-lan-policy
Fix: WakeOnLan policy
2023-10-04 11:36:16 +03:00
Reno Reckling
612035c45f
Fix broken genJqSecretsReplacementSnippet for jq 1.7 (#257932)
jq 1.7 updated it's behaviour and now throws an error
if the first argument is an empty string. It now needs
"." to pass the input through.
2023-09-30 14:00:13 +02:00
Jörg Thalheim
f1450e660f nixos/test-driver: whitelist variable names that don't follow pep8
https://docs.astral.sh/ruff/rules/invalid-argument-name/
2023-09-30 10:31:22 +02:00
Jörg Thalheim
1810265b57 nixos/test-driver: name exception according to pep8
see https://docs.astral.sh/ruff/rules/error-suffix-on-exception-name/
2023-09-30 10:31:22 +02:00
Jörg Thalheim
a1f01abe53 nixos/test-driver: apply ruff fixes & suggestions 2023-09-30 10:31:22 +02:00
Jörg Thalheim
93b1fa09d5 nixos/test-driver: disable typecheck for dependencies where don't have typing 2023-09-30 10:18:07 +02:00
Jörg Thalheim
d746557260 nixos/test-driver: add shell.nix
this useful for local development
2023-09-30 10:18:07 +02:00
Jörg Thalheim
9ac9e8407f nixos/test-driver: fix type errors in extract-docstrings 2023-09-30 10:18:06 +02:00
Jörg Thalheim
a1666863fd nixos/test-driver: convert to pyproject from setup.py
This also makes configuration available if you just run those tools locally.
Also use ruff instead of pylint because it's faster and more
comprehensive.
2023-09-30 10:17:47 +02:00
Raito Bezarius
81becd3c44 nixos/lib/test-driver: reduce spam at boot hangs
Since 008f9f0cd4
 ("nixos/test-driver: actually use the backdoor message to wait for backdoor"),

when boot is still computering, we can get a tons of empty strings in response to the shell.

This is not really useful to print and waste the disk space for any CI system that logs them.

We stop logging chunks whenever they are empty.
2023-09-29 03:45:31 +02:00
ign0tus
237f7ba7d2 networkd: Allow combinations of WakeOnLan policies
To comply with the systemd.link WakeOnLan[^1] specification, the option
"off" and all other possible policy combinations must be allowed.

[^1]: https://www.freedesktop.org/software/systemd/man/systemd.link.html#WakeOnLan=
2023-09-28 17:04:35 +02:00
Maciej Krüger
03762aa42a
test-driver: revert stderr nullpipe
Removes 2>/dev/null which re-adds stderr output breaking execute
2023-09-22 15:14:13 +02:00
Artturi
7f45760504
Merge pull request #192593 from jlesquembre/test-driver 2023-09-21 00:47:45 +03:00
José Luis Lafuente
c25c10e919 nixos/tests: make wait_for timeouts configurable
While working on #192270, I noticed that only some wait_for_* helper
functions make the timeout configurable. I think we should be able to
customize it in all cases
2023-09-20 21:56:46 +03:00
Maciej Krüger
922926cfbc
Merge pull request #253876 from nbraud/nixos/sudo-rs 2023-09-20 13:55:33 +02:00
Will Fancher
c6db677b1c
Merge pull request #255008 from SuperSandro2000/x-triggers-name
systemd-lib: add name to X-{Reloads,Restart}-Triggers to easily ident…
2023-09-19 17:38:05 -04:00
Maciej Krüger
4729358fa5 nixos/test-driver: do not break if the command writes to stderr
Capturing `stderr` as part of the return `output` could break existing tests.
2023-09-18 17:36:16 +00:00
Artturin
38f37080c5 nixos/lib/make-btrfs-fs: copy improvements from
https://git.sr.ht/~c00w/nixpkgs/tree/sdimagebtrfs/item/nixos/lib/make-btrfs-fs.nix

I made only one change which was to use `btrfs check` instead of
`fsck.btrfs` because of this warning

```
btrfs-fs.img> ++ fsck.btrfs /nix/store/6d46rc768c140asy6rjpc5rk568r36zq-btrfs-fs.img
btrfs-fs.img> If you wish to check the consistency of a BTRFS filesystem or
btrfs-fs.img> repair a damaged filesystem, see btrfs(8) subcommand 'check'.
```

Co-authored-by: Colin L Rice <colin@daedrum.net>
2023-09-15 08:04:40 +03:00
Artturi
fc21cde24b
Merge pull request #91956 from c00w/makebtrfs 2023-09-15 07:37:07 +03:00
Sandro Jäckel
9e5aa81a22
systemd-lib: add name to X-{Reloads,Restart}-Triggers to easily identify to which service/unit/... they belong 2023-09-13 21:03:37 +02:00
Artturi
7b33eb656c
Merge pull request #250318 from Artturin/copycrossfix 2023-09-06 00:37:15 +03:00
Artturin
053e69578f nixos/testing/driver: Copy cross fix from modules/misc/nixpkgs.nix
f7077ba131

Fixes `error: makeWrapper/makeShellWrapper must be in nativeBuildInputs`

`pkgsCross.aarch64-multiplatform.nixosTests.sway`
2023-09-03 00:19:29 +03:00
Rick van Schijndel
12701f7a26
Merge pull request #250248 from Artturin/onlylimiti686
make-squashfs: Only limit cores to 48 on i686
2023-08-20 11:26:28 +02:00
Artturin
91dd8b9324 make-squashfs: Only limit cores to 48 on i686
There shouldn't be a need to limit it on other systems
2023-08-19 23:40:07 +03:00
Jacek Galowicz
36e94693b7
Merge pull request #245879 from teto/test-driver
test-driver: add persistent history
2023-08-17 11:57:37 +02:00
Bobby Rong
a0c846a05a
nixos/test-driver: format
There is a `black --check --diff ${src}/test_driver` check in
nixos-test-driver's checkPhase so this format change will be needed.
2023-07-30 21:24:49 +08:00
Jacek Galowicz
b1b263e5f7
Merge pull request #246093 from blaggacao/fix-nixos-tests-log-backdoor-service-failure
nixos/test-driver: log what to do if backdoor service doesn't come oneline
2023-07-30 13:20:44 +02:00
David Arnold
84d9a1e808
nixos/test-driver: log what to do if backdoor service doesn't come oneline 2023-07-29 15:01:58 -05:00
Matthieu Coudron
3a7597b8a6 test-driver: add persistent history
across sessions of interactive testing
2023-07-29 16:52:31 +02:00
r-vdp
5054472759
nixos: make extendModules retain pkgs on nixos configs 2023-07-28 18:36:05 +02:00
nikstur
a662dc8b73 nixos/lib: systemd definition files function
Add a re-usable function that converts an attrset to a directory
containing systemd definition files.
2023-07-26 23:30:08 +02:00
Jacek Galowicz
f59913bad8
Merge pull request #241949 from R-VdP/nixos_test_busybox
nixos/test-driver: use the short form argument to base64 for busybox compatibility.
2023-07-24 18:05:06 +02:00
Florian Klink
77f8c78bea
Merge pull request #244466 from RaitoBezarius/networkd/netdev-mac
nixos/networkd: fix netdev MAC addresses asserts
2023-07-20 16:39:32 +03:00
Ryan Lahfa
faa1bc7353
Merge pull request #244395 from pogobanane/master 2023-07-20 13:08:17 +02:00
Raito Bezarius
1ca68deebd nixos/networkd: fix netdev MAC addresses asserts
The `||` condition made it fail no matter what because nothing can be none and a proper MAC address.

Thanks to trofi for catching it.
2023-07-20 11:03:46 +02:00
Florian Klink
6f66c57acc
Merge pull request #241365 from RaitoBezarius/macaddrs-netdevs
nixos/networkd: support netdev MAC addresses
2023-07-19 23:03:34 +03:00
Pogobanane
d7740c24cb nixos/lib/make-disk-image: fix installBootLoader for disabled grub
This commit is a fixup for a regression introduced by
0bdba6c99b.

Before the regression, it was possible to build images without grub or a
kernel (e.g. to boot other kernels with qemu -kernel.
After the regression, such images fail to build. Since
config.boog.loader.grub.enable is false in that scenario, grub.device is
emptystring. While this happens not to be an issue of `ln`, `dirname`
fails on emptystring.

With this change, we guard both commands to only be run when grub is
actually enabled. Images with and without grub succesfully build with
this change.
2023-07-19 20:04:57 +02:00
Robert Hensing
13222d8d86
Merge pull request #242135 from tfc/test-driver-doc-autogen
Integration Test Driver: Improve documentation, Sync Docs with Code docstrings
2023-07-18 21:17:44 +02:00
Felix Buehler
bec27fabee treewide: use lib.optional instead of 'then []' 2023-07-12 09:36:28 +01:00