Skip to content

Instantly share code, notes, and snippets.

@tfc
Created August 24, 2022 09:10
Show Gist options
  • Save tfc/8c1f4001aa711b93f78cac765049cb9e to your computer and use it in GitHub Desktop.
Save tfc/8c1f4001aa711b93f78cac765049cb9e to your computer and use it in GitHub Desktop.
From f2d7b1b89e4429e2dc93bdc7528ac86bb23dbf41 Mon Sep 17 00:00:00 2001
From: Jacek Galowicz <jacek.galowicz@cyberus-technology.de>
Date: Wed, 24 Aug 2022 11:09:32 +0200
Subject: [PATCH] Modularize login test
---
nixos/tests/all-tests.nix | 3 +--
nixos/tests/login.nix | 22 ++++++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index d5e8fdaafe5..6a1aa20f812 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -313,7 +313,6 @@ in {
krb5 = discoverTests (import ./krb5 {});
ksm = handleTest ./ksm.nix {};
kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {};
- latestKernel.login = handleTest ./login.nix { latestKernel = true; };
leaps = handleTest ./leaps.nix {};
libinput = handleTest ./libinput.nix {};
libreddit = handleTest ./libreddit.nix {};
@@ -327,7 +326,7 @@ in {
limesurvey = handleTest ./limesurvey.nix {};
litestream = handleTest ./litestream.nix {};
locate = handleTest ./locate.nix {};
- login = handleTest ./login.nix {};
+ login = runTest ./login.nix;
logrotate = handleTest ./logrotate.nix {};
loki = handleTest ./loki.nix {};
lvm2 = handleTest ./lvm2 {};
diff --git a/nixos/tests/login.nix b/nixos/tests/login.nix
index 2cff38d2005..17c97f03848 100644
--- a/nixos/tests/login.nix
+++ b/nixos/tests/login.nix
@@ -1,16 +1,22 @@
-import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
-
+{ lib, ... }:
{
name = "login";
- meta = with pkgs.lib.maintainers; {
+ meta = with lib.maintainers; {
maintainers = [ eelco ];
};
- nodes.machine =
- { pkgs, lib, ... }:
- { boot.kernelPackages = lib.mkIf latestKernel pkgs.linuxPackages_latest;
- sound.enable = true; # needed for the factl test, /dev/snd/* exists without them but udev doesn't care then
+ matrix.kernel.choice.default = {};
+ matrix.kernel.choice.latest.module = {
+ nodes.machine = { pkgs, ... }: {
+ boot.kernelPackages = pkgs.linuxPackages_latest;
};
+ };
+
+ nodes.machine = {
+ # needed for the factl test, /dev/snd/* exists without them but
+ # udev doesn't care then
+ sound.enable = true;
+ };
testScript = ''
machine.wait_for_unit("multi-user.target")
@@ -56,4 +62,4 @@ import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
machine.send_key("ctrl-alt-delete")
machine.wait_for_shutdown()
'';
-})
+}
--
2.36.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment