about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2019-12-13 21:47:15 +0100
committerChristian Kampka <christian@kampka.net>2019-12-14 10:58:38 +0100
commitc98d54a3e9ffd3b159cdeeb28d7bc87305fbd472 (patch)
tree18471a78e8106cdaaca8e86620b907f18b8fab01 /nixos
parentb85286fe667f5c57a221a0e98269235507135c50 (diff)
downloadnixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.tar
nixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.tar.gz
nixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.tar.bz2
nixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.tar.lz
nixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.tar.xz
nixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.tar.zst
nixlib-c98d54a3e9ffd3b159cdeeb28d7bc87305fbd472.zip
zsh-history: Add tests
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/zsh-history.nix35
2 files changed, 36 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 39ee3206d806..5407a071cadd 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -294,5 +294,6 @@ in
   xss-lock = handleTest ./xss-lock.nix {};
   yabar = handleTest ./yabar.nix {};
   yggdrasil = handleTest ./yggdrasil.nix {};
+  zsh-history = handleTest ./zsh-history.nix {};
   zookeeper = handleTest ./zookeeper.nix {};
 }
diff --git a/nixos/tests/zsh-history.nix b/nixos/tests/zsh-history.nix
new file mode 100644
index 000000000000..4380ec9adfd2
--- /dev/null
+++ b/nixos/tests/zsh-history.nix
@@ -0,0 +1,35 @@
+import ./make-test-python.nix ({ pkgs, ...} : {
+  name = "zsh-history";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ kampka ];
+  };
+
+  nodes.default = { ... }: {
+    programs = {
+      zsh.enable = true;
+    };
+    environment.systemPackages = [ pkgs.zsh-history ];
+    programs.zsh.interactiveShellInit = ''
+      source ${pkgs.zsh-history.out}/share/zsh/init.zsh
+    '';
+    users.users.root.shell = "${pkgs.zsh}/bin/zsh";
+  };
+
+  testScript = ''
+    start_all()
+    default.wait_for_unit("multi-user.target")
+    default.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
+
+    # Login
+    default.wait_until_tty_matches(1, "login: ")
+    default.send_chars("root\n")
+    default.wait_until_tty_matches(1, "root@default>")
+
+    # Generate some history
+    default.send_chars("echo foobar\n")
+    default.wait_until_tty_matches(1, "foobar")
+
+    # Ensure that command was recorded in history
+    default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
+  '';
+})