From de8033747c6b87a57869e2796155d2495770bbfd Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 26 Jan 2020 12:00:03 +0100 Subject: [PATCH] tests: clean up tests - Move all module tests to their own directories. - Avoid duplication of `// import`. --- tests/default.nix | 68 +++++++++---------- .../{ => browserpass}/browserpass.nix | 0 .../modules/programs/browserpass/default.nix | 3 + tests/modules/programs/getmail/default.nix | 3 + .../{ => getmail}/getmail-expected.conf | 0 .../programs/{ => getmail}/getmail.nix | 2 +- tests/modules/programs/mbsync/default.nix | 3 + .../{ => mbsync}/mbsync-expected.conf | 0 .../modules/programs/{ => mbsync}/mbsync.nix | 2 +- tests/modules/programs/texlive/default.nix | 3 + .../{ => texlive}/texlive-minimal.nix | 0 .../services/window-managers/i3/default.nix | 3 + .../{ => i3}/i3-keybindings-expected.conf | 0 .../{ => i3}/i3-keybindings.nix | 0 tests/modules/xresources/default.nix | 3 + .../{ => xresources}/xresources-expected.conf | 0 tests/modules/{ => xresources}/xresources.nix | 0 17 files changed, 54 insertions(+), 36 deletions(-) rename tests/modules/programs/{ => browserpass}/browserpass.nix (100%) create mode 100644 tests/modules/programs/browserpass/default.nix create mode 100644 tests/modules/programs/getmail/default.nix rename tests/modules/programs/{ => getmail}/getmail-expected.conf (100%) rename tests/modules/programs/{ => getmail}/getmail.nix (91%) create mode 100644 tests/modules/programs/mbsync/default.nix rename tests/modules/programs/{ => mbsync}/mbsync-expected.conf (100%) rename tests/modules/programs/{ => mbsync}/mbsync.nix (91%) create mode 100644 tests/modules/programs/texlive/default.nix rename tests/modules/programs/{ => texlive}/texlive-minimal.nix (100%) create mode 100644 tests/modules/services/window-managers/i3/default.nix rename tests/modules/services/window-managers/{ => i3}/i3-keybindings-expected.conf (100%) rename tests/modules/services/window-managers/{ => i3}/i3-keybindings.nix (100%) create mode 100644 tests/modules/xresources/default.nix rename tests/modules/{ => xresources}/xresources-expected.conf (100%) rename tests/modules/{ => xresources}/xresources.nix (100%) diff --git a/tests/default.nix b/tests/default.nix index 01b316cd8c6..49c27239730 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,44 +11,44 @@ let sha256 = "1qr1shhapjn4nnd4k6hml69ri8vgz4l8lakjll5hc516shs9a9nn"; }; - modules = import ../modules/modules.nix { inherit lib pkgs; check = false; }; + modules = import ../modules/modules.nix { + inherit lib pkgs; + check = false; + }; in import nmt { inherit lib pkgs modules; testedAttrPath = [ "home" "activationPackage" ]; - tests = { - browserpass = ./modules/programs/browserpass.nix; - mbsync = ./modules/programs/mbsync.nix; - texlive-minimal = ./modules/programs/texlive-minimal.nix; - xresources = ./modules/xresources.nix; - } - // pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux ( - { - getmail = ./modules/programs/getmail.nix; - i3-keybindings = ./modules/services/window-managers/i3-keybindings.nix; - } - // import ./modules/misc/pam - // import ./modules/misc/xdg - // import ./modules/misc/xsession - // import ./modules/programs/firefox - // import ./modules/programs/neomutt - // import ./modules/programs/rofi - // import ./modules/services/sxhkd - // import ./modules/systemd - ) - // import ./lib/types - // import ./modules/files - // import ./modules/home-environment - // import ./modules/misc/fontconfig - // import ./modules/programs/alacritty - // import ./modules/programs/bash - // import ./modules/programs/git - // import ./modules/programs/gpg - // import ./modules/programs/newsboat - // import ./modules/programs/readline - // import ./modules/programs/ssh - // import ./modules/programs/tmux - // import ./modules/programs/zsh; + tests = builtins.foldl' (a: b: a // (import b)) { } ([ + ./lib/types + ./modules/files + ./modules/home-environment + ./modules/misc/fontconfig + ./modules/programs/alacritty + ./modules/programs/bash + ./modules/programs/browserpass + ./modules/programs/git + ./modules/programs/gpg + ./modules/programs/mbsync + ./modules/programs/neomutt + ./modules/programs/newsboat + ./modules/programs/readline + ./modules/programs/ssh + ./modules/programs/texlive + ./modules/programs/tmux + ./modules/programs/zsh + ./modules/xresources + ] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [ + ./modules/misc/pam + ./modules/misc/xdg + ./modules/misc/xsession + ./modules/programs/firefox + ./modules/programs/getmail + ./modules/programs/rofi + ./modules/services/sxhkd + ./modules/services/window-managers/i3 + ./modules/systemd + ]); } diff --git a/tests/modules/programs/browserpass.nix b/tests/modules/programs/browserpass/browserpass.nix similarity index 100% rename from tests/modules/programs/browserpass.nix rename to tests/modules/programs/browserpass/browserpass.nix diff --git a/tests/modules/programs/browserpass/default.nix b/tests/modules/programs/browserpass/default.nix new file mode 100644 index 00000000000..478530f78ad --- /dev/null +++ b/tests/modules/programs/browserpass/default.nix @@ -0,0 +1,3 @@ +{ + browserpass = ./browserpass.nix; +} diff --git a/tests/modules/programs/getmail/default.nix b/tests/modules/programs/getmail/default.nix new file mode 100644 index 00000000000..a0d79e7d02d --- /dev/null +++ b/tests/modules/programs/getmail/default.nix @@ -0,0 +1,3 @@ +{ + getmail = ./getmail.nix; +} diff --git a/tests/modules/programs/getmail-expected.conf b/tests/modules/programs/getmail/getmail-expected.conf similarity index 100% rename from tests/modules/programs/getmail-expected.conf rename to tests/modules/programs/getmail/getmail-expected.conf diff --git a/tests/modules/programs/getmail.nix b/tests/modules/programs/getmail/getmail.nix similarity index 91% rename from tests/modules/programs/getmail.nix rename to tests/modules/programs/getmail/getmail.nix index 6b572f15ce6..d72a8d6505a 100644 --- a/tests/modules/programs/getmail.nix +++ b/tests/modules/programs/getmail/getmail.nix @@ -3,7 +3,7 @@ with lib; { - imports = [ ../accounts/email-test-accounts.nix ]; + imports = [ ../../accounts/email-test-accounts.nix ]; config = { home.username = "hm-user"; diff --git a/tests/modules/programs/mbsync/default.nix b/tests/modules/programs/mbsync/default.nix new file mode 100644 index 00000000000..c31e0dc7a9d --- /dev/null +++ b/tests/modules/programs/mbsync/default.nix @@ -0,0 +1,3 @@ +{ + mbsync = ./mbsync.nix; +} diff --git a/tests/modules/programs/mbsync-expected.conf b/tests/modules/programs/mbsync/mbsync-expected.conf similarity index 100% rename from tests/modules/programs/mbsync-expected.conf rename to tests/modules/programs/mbsync/mbsync-expected.conf diff --git a/tests/modules/programs/mbsync.nix b/tests/modules/programs/mbsync/mbsync.nix similarity index 91% rename from tests/modules/programs/mbsync.nix rename to tests/modules/programs/mbsync/mbsync.nix index fa9768a2fe1..072a7271f00 100644 --- a/tests/modules/programs/mbsync.nix +++ b/tests/modules/programs/mbsync/mbsync.nix @@ -3,7 +3,7 @@ with lib; { - imports = [ ../accounts/email-test-accounts.nix ]; + imports = [ ../../accounts/email-test-accounts.nix ]; config = { home.username = "hm-user"; diff --git a/tests/modules/programs/texlive/default.nix b/tests/modules/programs/texlive/default.nix new file mode 100644 index 00000000000..e9a6f882b62 --- /dev/null +++ b/tests/modules/programs/texlive/default.nix @@ -0,0 +1,3 @@ +{ + texlive-minimal = ./texlive-minimal.nix; +} diff --git a/tests/modules/programs/texlive-minimal.nix b/tests/modules/programs/texlive/texlive-minimal.nix similarity index 100% rename from tests/modules/programs/texlive-minimal.nix rename to tests/modules/programs/texlive/texlive-minimal.nix diff --git a/tests/modules/services/window-managers/i3/default.nix b/tests/modules/services/window-managers/i3/default.nix new file mode 100644 index 00000000000..6105eb41514 --- /dev/null +++ b/tests/modules/services/window-managers/i3/default.nix @@ -0,0 +1,3 @@ +{ + i3-keybindings = ./i3-keybindings.nix; +} diff --git a/tests/modules/services/window-managers/i3-keybindings-expected.conf b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf similarity index 100% rename from tests/modules/services/window-managers/i3-keybindings-expected.conf rename to tests/modules/services/window-managers/i3/i3-keybindings-expected.conf diff --git a/tests/modules/services/window-managers/i3-keybindings.nix b/tests/modules/services/window-managers/i3/i3-keybindings.nix similarity index 100% rename from tests/modules/services/window-managers/i3-keybindings.nix rename to tests/modules/services/window-managers/i3/i3-keybindings.nix diff --git a/tests/modules/xresources/default.nix b/tests/modules/xresources/default.nix new file mode 100644 index 00000000000..0e96aef9fe2 --- /dev/null +++ b/tests/modules/xresources/default.nix @@ -0,0 +1,3 @@ +{ + xresources = ./xresources.nix; +} diff --git a/tests/modules/xresources-expected.conf b/tests/modules/xresources/xresources-expected.conf similarity index 100% rename from tests/modules/xresources-expected.conf rename to tests/modules/xresources/xresources-expected.conf diff --git a/tests/modules/xresources.nix b/tests/modules/xresources/xresources.nix similarity index 100% rename from tests/modules/xresources.nix rename to tests/modules/xresources/xresources.nix