about summary refs log tree commit diff
path: root/nixos/tests/common
AgeCommit message (Collapse)AuthorFilesLines
2024-04-13nixos: remove all uses of lib.mdDocstuebinm3-5/+5
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
2024-04-08treewide: rename renamed sddm/displayManager settingsSandro Jäckel2-7/+5
2024-02-27nixos/lib/test-driver: drop LegacyStartCommand, clean up create_machine APIK9001-1/+1
We can finally do this now that it's no longer used.
2023-10-30systemd-stage-1: Add assertions for unsupported options.Will Fancher1-3/+3
2023-08-17nixos/tests/lxd: move into subdir, use minimal init, remove sleepsAdam Stephens1-24/+0
2023-07-26nixos/tests: use sensible key type for gpg keyringnikstur1-4/+2
If someone blindly copies this code, at least they have a sensible key type.
2023-07-26nixos/tests: refactor gpg-keyring test utilitynikstur1-0/+23
2023-07-12treewide: use lib.optional instead of 'then []'Felix Buehler1-1/+1
2023-06-16nixos/qemu-vm: use persistent block device namesnikstur1-0/+29
This change removes the bespoke logic around identifying block devices. Instead of trying to find the right device by iterating over `qemu.drives` and guessing the right partition number (e.g. /dev/vda{1,2}), devices are now identified by persistent names provided by udev in /dev/disk/by-*. Before this change, the root device was formatted on demand in the initrd. However, this makes it impossible to use filesystem identifiers to identify devices. Now, the formatting step is performed before the VM is started. Because some tests, however, rely on this behaviour, a utility function to replace this behaviour in added in /nixos/tests/common/auto-format-root-device.nix. Devices that contain neither a partition table nor a filesystem are identified by their hardware serial number which is injecetd via QEMU (and is thus persistent and predictable). PCI paths are not a reliably way to identify devices because their availability and numbering depends on the QEMU machine type. This change makes the module more robust against changes in QEMU and the kernel (non-persistent device naming) and by decoupling abstractions (i.e. rootDevice, bootPartition, and bootLoaderDevice) enables further improvement down the line.
2023-05-12nixos/tests/common/auto.nix: get rid of `with lib`Anderson Torres1-16/+3
2023-05-12nixos/tests/common/acme/server/default.nix: get rid of `with lib`Anderson Torres1-5/+5
2023-04-16nixos/tests/ec2: Fix test toolingLeon Barrett1-1/+8
This change fixes two problems with the qemu testing code: 1. Previously, the qemu-img command was missing a disk image format argument. 2. Previously, if a test assertion failed, the test hung because the VM was not torn down.
2023-01-12nixos/tests/acme/generate-certs: deprecate phasesFelix Buehler1-1/+1
2022-12-17nixos: fix typosfigsoda1-1/+1
2022-11-21nixos/tests/acme/server: generate certs with longer validityajs1244-83/+83
2022-11-21nixos/tests/acme/server: patch certificate generation for longer validityajs1241-1/+5
2022-11-20nixos/tests/acme/server: regenerate certsajs1244-83/+83
expired today
2022-10-06nixos/acme: Disable lego renew sleepingLucas Savva1-5/+0
Lego has a built-in mechanism for sleeping for a random amount of time before renewing a certificate. In our environment this is not only unnecessary (as our systemd timer takes care of it) but also unwanted since it slows down the execution of the systemd service encompassing it, thus also slowing down the start up of any services its depending on. Also added FixedRandomDelay to the timer for more predictability.
2022-10-06nixos/acme: Make account creds check more robustLucas Savva1-0/+5
Fixes #190493 Check if an actual key file exists. This does not completely cover the work accountHash does to ensure that a new account is registered when account related options are changed.
2022-09-21nixosTests.acme: Use module system based runnerRobert Hensing2-5/+5
2022-08-31nixos/*: convert internal option descriptions to MDpennae1-3/+3
we'll have to do it eventually, may as well be now.
2022-08-31nixos/*: automatically convert option descriptionspennae2-8/+8
conversions were done using https://github.com/pennae/nix-doc-munge using (probably) rev f34e145 running nix-doc-munge nixos/**/*.nix nix-doc-munge --import nixos/**/*.nix the tool ensures that only changes that could affect the generated manual *but don't* are committed, other changes require manual review and are discarded.
2022-05-03nixos/lxd: improve testsPatryk Wychowaniec1-0/+24
- Make tests/lxd.nix use NixOS's lxdMeta & lxdImage to avoid relying on 3rd party containers such as Alpine Linux for testing purposes. - Merge tests/lxd-image.nix into tests/lxd.nix, since now both have a similar structure. - Extract duplicated inline LXD configuration into a separate file, - Add passthru.lxd-nftables & passthru.lxd-image-server.
2021-12-26nixos/acme: Add defaults and inheritDefaults optionLucas Savva2-2/+9
Allows configuring many default settings for certificates, all of which can still be overridden on a per-cert basis. Some options have been moved into .defaults from security.acme, namely email, server, validMinDays and renewInterval. These changes will not break existing configurations thanks to mkChangedOptionModule. With this, it is also now possible to configure DNS-01 with web servers whose virtualHosts utilise enableACME. The only requirement is you set `acmeRoot = null` for each vhost. The test suite has been revamped to cover these additions and also to generally make it easier to maintain. Test config for apache and nginx has been fully standardised, and it is now much easier to add a new web server if it follows the same configuration patterns as those two. I have also optimised the use of switch-to-configuration which should speed up testing.
2021-11-21nixos/qemu-vm: default memorySize 384 -> 1024Artturin1-1/+0
the default hasn't been changed since 2009 this can improve our test performances nixos/tests: remove explicit memorySize <1024 1024MiB is now the default
2021-11-19nixos/tests/vscodium-wayland: initPatrick Hilhorst1-0/+14
2021-08-20nixos/test: some test fixes in succession of #125992David Arnold1-0/+1
2020-10-22nixos/tests/acme: Hard code test certificatesLucas Savva8-32/+148
The added README.md explains why this has been done.
2020-10-07nixos/acme: Fix ocspMustStaple option and add testLucas Savva1-1/+1
Some of the testing setup for OCSP checking was wrong and has been fixed too.
2020-10-03nixosTests.ec2-config: avoid an evaluation problemVladimír Čunát1-1/+3
The problem was introduced by commit 97a32bc (within PR #79696). nixos/tests/common/ec2.nix:6:17 called with unexpected argument 'meta'
2020-09-02nixos/acme: Restructure moduleLucas Savva5-286/+79
- Use an acme user and group, allow group override only - Use hashes to determine when certs actually need to regenerate - Avoid running lego more than necessary - Harden permissions - Support "systemctl clean" for cert regeneration - Support reuse of keys between some configuration changes - Permissions fix services solves for previously root owned certs - Add a note about multiple account creation and emails - Migrate extraDomains to a list - Deprecate user option - Use minica for self-signed certs - Rewrite all tests I thought of a few more cases where things may go wrong, and added tests to cover them. In particular, the web server reload services were depending on the target - which stays alive, meaning that the renewal timer wouldn't be triggering a reload and old certs would stay on the web servers. I encountered some problems ensuring that the reload took place without accidently triggering it as part of the test. The sync commands I added ended up being essential and I'm not sure why, it seems like either node.succeed ends too early or there's an oddity of the vm's filesystem I'm not aware of. - Fix duplicate systemd rules on reload services Since useACMEHost is not unique to every vhost, if one cert was reused many times it would create duplicate entries in ${server}-config-reload.service for wants, before and ConditionPathExists
2020-08-24nixos/acme: fix subjectAltName in test snakeoil certsJamie McClymont2-153/+155
2020-08-23nixosTests.ec2: Port tests that depend on common/ec2.nixJacek Galowicz1-22/+36
2020-07-09nixos/displayManager: make autoLogin options independent of DM typeworldofpeace1-2/+2
Co-authored-by: volth <volth@volth.com>
2020-04-18nixos/tests/common/acme: don't set nameservers for clientEmily2-6/+2
The resolver is mainly useful for the ACME server, and acme.nix uses its own DNS server to test DNS-01 challenges.
2020-04-18nixos/tests/common/acme: enable Pebble strict modeEmily1-0/+1
This lets us get early warning about any bugs or backwards-compatibility hazards in lego. Pebble will default to this in the future, but doesn't currently; see https://github.com/letsencrypt/pebble/blob/v2.3.0/README.md#strict-mode.
2020-04-18nixos/tests/acme: use CAP_NET_BIND_SERVICEEmily1-2/+1
2020-04-18nixos/tests/acme: use *.test domainsEmily8-284/+207
Shimming out the Let's Encrypt domain name to reuse client configuration doesn't work properly (Pebble uses different endpoint URL formats), is recommended against by upstream,[1] and is unnecessary now that the ACME module supports specifying an ACME server. This commit changes the tests to use the domain name acme.test instead, and renames the letsencrypt node to acme to reflect that it has nothing to do with the ACME server that Let's Encrypt runs. The imports are renamed for clarity: * nixos/tests/common/{letsencrypt => acme}/{common.nix => client} * nixos/tests/common/{letsencrypt => acme}/{default.nix => server} The test's other domain names are also adjusted to use *.test for consistency (and to avoid misuse of non-reserved domain names such as standalone.com). [1] https://github.com/letsencrypt/pebble/issues/283#issuecomment-545123242 Co-authored-by: Yegor Timoshenko <yegortimoshenko@riseup.net>
2020-02-09nixos/acme: Update release note, remove redundant requiresLucas Savva3-4/+77
Merge remote-tracking branch 'remotes/upstream/master'
2020-02-09nixos/acme: add dns-01 test, fix cert locating bugLucas Savva1-0/+3
2020-01-29nixos/display-managers/auto: removeworldofpeace2-2/+75
This module allows root autoLogin, so we would break that for users, but they shouldn't be using it anyways. This gives the impression like auto is some special display manager, when it's just lightdm and special pam rules to allow root autoLogin. It was created for NixOS's testing so I believe this is where it belongs.
2020-01-13nixos/tests/ec2: return to passing stateAndrew Childs1-2/+2
Updates required: - Use vpc image format (new default, supported by Amazon) - Pass full image filename to makeEc2Test - Increase memory allocation for nixos-rebuild - Set a networking.hostName for services.httpd - Add appropriate escaping in literal userdata While I'm here, try to make it fail fast.
2019-12-21nixos/tests/user-account: add static uid for aliceworldofpeace1-0/+1
A lot of tests assume that the alice user will have a uid of 1000. Let's make that a guarantee and be able to reference this value.
2019-12-15nixos/displayManager: deprecate separate options for default wm/dmJan Tojnar1-4/+4
The upstream session files display managers use have no concept of sessions being composed from desktop manager and window manager. To be able to set upstream session files as default session, we need a single option. Having two different ways to set default session would be confusing, though, so we decided to deprecate the old method. We also created separate script for each session, just like we already had a separate desktop file for each one, and started using displayManager.sessionPackages mechanism to make the session handling more uniform.
2019-10-30nixos/tests/acme.nix: remove pebble custom endpoint patchFélix Baylac-Jacqué2-36/+1
The recent custom endpoint addition allows us to directly point certbot to the custom Pebble directory endpoint. Thanks to that, we can ditch the Pebble patch we were using so far; making this test maintenance easier.
2019-10-23nixos/tests/letsencrypt: use Pebble instead of BoulderFélix Baylac-Jacqué5-587/+295
Let's encrypt bumped ACME to V2. We need to update our nixos test to be compatible with this new protocol version. We decided to drop the Boulder ACME server in favor of the more integration test friendly Pebble. - overriding cacert not necessary - this avoids rebuilding lots of packages needlessly - nixos/tests/acme: use pebble's ca for client tests - pebble always generates its own ca which has to be fetched TODO: write proper commit msg :)
2019-08-15treewide: name -> pname (easy cases) (#66585)volth1-2/+2
treewide replacement of stdenv.mkDerivation rec { name = "*-${version}"; version = "*"; to pname
2019-04-06nixos/tests/acme: Use exact match in TOS locationaszlig1-1/+1
Since the switch to check the nginx config with gixy in 59fac1a6d7e1983a1e7bd518129ff9ef39a013dd, the ACME test doesn't build anymore, because gixy reports the following false-positive (reindented): >> Problem: [alias_traversal] Path traversal via misconfigured alias. Severity: MEDIUM Description: Using alias in a prefixed location that doesn't ends with directory separator could lead to path traversal vulnerability. Additional info: https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md Pseudo config: server { server_name letsencrypt.org; location /documents/2017.11.15-LE-SA-v1.2.pdf { alias /nix/store/y4h5ryvnvxkajkmqxyxsk7qpv7bl3vq7-2017.11.15-LE-SA-v1.2.pdf; } } The reason this is a false-positive is because the destination is not a directory, so something like "/foo.pdf../other.txt" won't work here, because the resulting path would be ".../destfile.pdf../other.txt". Nevertheless it's a good idea to use the exact match operator (=), to not only shut up gixy but also gain a bit of performance in lookup (not that it would matter in our test). Signed-off-by: aszlig <aszlig@nix.build>
2019-03-22nixos docs: run the formatting tool (no content change)Vladimír Čunát1-7/+19
As documented in the docs themselves :-)
2019-02-11nixos/tests/ec2: reuse ssh keys from ssh-keys.nixAntoine Eiche1-12/+0