Commit graph

937 commits

Author SHA1 Message Date
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
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
Jacek Galowicz 846ad444c7 integration test driver: Auto-generate integration test driver's machine
method documentation of nixos docs from python doc strings
2023-07-10 08:51:52 +02:00
Jacek Galowicz c916884f86 integration test driver: Synchronize integration test driver's docstrings in Machine class methods with nixos documentation 2023-07-09 13:57:07 +02:00
Jacek Galowicz c97588eedc integration test driver: Adapt test script checking output 2023-07-09 13:57:07 +02:00
K900 8533b23159 nixos/networkd: fix mismerge of #240969 and #241362 2023-07-09 07:34:42 +03:00
K900 008f9f0cd4 nixos/test-driver: actually use the backdoor message to wait for backdoor
New EDK2 sets up the backdoor port as a serial console, which feeds the test driver
a bunch of boot logs it can safely ignore. Do so by waiting for the message the
backdoor shell prints before doing anything else.
2023-07-08 20:21:50 +03:00
r-vdp 50c922e395
nixos/test-driver: use the short form argument to base64 for busybox compatibility.
Fixes #241938
2023-07-06 17:21:10 +02:00
Raito Bezarius 4d38fa043b nixos/networkd: support netdev MAC addresses
According to systemd.netdev manpage:

```
MACAddress=
           Specifies the MAC address to use for the device, or takes the special value "none". When "none", systemd-networkd does not request the MAC address for
           the device, and the kernel will assign a random MAC address. For "tun", "tap", or "l2tp" devices, the MACAddress= setting in the [NetDev] section is
           not supported and will be ignored. Please specify it in the [Link] section of the corresponding systemd.network(5) file. If this option is not set,
           "vlan" device inherits the MAC address of the master interface. For other kind of netdevs, if this option is not set, then the MAC address is
           generated based on the interface name and the machine-id(5).

           Note, even if "none" is specified, systemd-udevd will assign the persistent MAC address for the device, as 99-default.link has
           MACAddressPolicy=persistent. So, it is also necessary to create a custom .link file for the device, if the MAC address assignment is not desired.
```

Therefore, `none` is an acceptable value.
2023-07-04 01:21:35 +02:00
mutantmell d51ebb6173 nixos/networkd: refactor
Reduces size of networkd module by moving unit file generation code into a util.
2023-07-01 17:17:51 -07:00
Arthur Gautier 18c734d7f2 nixosTest: adds support for lib.extend
When lib overrides were used, before this commit, they would not be made
available in the configuration evaluation of nixosTest's nodes.

Sample code:
``` nix
let
  pkgs = import ./. {
    overlays = [
      (new: old: {
        lib = old.lib.extend (self: super: {
          sorry_dave = builtins.trace "There are no pod bay doors" "sorry dave";
        });
      })
    ];
  };
in
pkgs.testers.nixosTest {
  name = "demo lib overlay";

  nodes = {
    machine = { lib, ... }: {
      environment.etc."got-lib-overlay".text = lib.sorry_dave;
    };
  };

  testScript = { nodes }:
    ''
      start_all()
      machine.succeed('grep dave /etc/got-lib-overlay')
    '';
}
```
2023-06-29 09:13:44 -07:00
Alyssa Ross 3959a7bef5 nixos/qemu: set qemuSerialDevice for loongarch64
Link: https://www.qemu.org/docs/master/system/loongarch/virt.html#boot-options
2023-06-26 08:58:20 +00:00
pennae c8b4e5d557
Merge pull request #237557 from pennae/dedocbookify-nixos
nixos/doc: dedocbookify
2023-06-19 14:05:03 +02:00
Ryan Lahfa 3d941b6be8
Merge pull request #236656 from nikstur/qemu-vm-persistent-block-device-names 2023-06-17 14:52:26 +02:00
Raito Bezarius 7088e386ff nixosTests.kexec: reconnect properly after 2nd kexec
By some miracle, before, it was possible to reconnect to the `node1` without
doing any relevant dance.

But now we are direct booting (¿), it seems like we need to do the right things.

This introduces a `check_output` flag for `execute` because we do not want to steal the
messages from the backdoor service as we might execute the kexec too fast compared
to when we will reconnect.

Therefore, we will let the message in the pipe if needed.
2023-06-16 19:43:40 +02:00