Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

zsh-history: Add tests

+41 -1
+1
nixos/tests/all-tests.nix
··· 294 294 xss-lock = handleTest ./xss-lock.nix {}; 295 295 yabar = handleTest ./yabar.nix {}; 296 296 yggdrasil = handleTest ./yggdrasil.nix {}; 297 + zsh-history = handleTest ./zsh-history.nix {}; 297 298 zookeeper = handleTest ./zookeeper.nix {}; 298 299 }
+35
nixos/tests/zsh-history.nix
··· 1 + import ./make-test-python.nix ({ pkgs, ...} : { 2 + name = "zsh-history"; 3 + meta = with pkgs.stdenv.lib.maintainers; { 4 + maintainers = [ kampka ]; 5 + }; 6 + 7 + nodes.default = { ... }: { 8 + programs = { 9 + zsh.enable = true; 10 + }; 11 + environment.systemPackages = [ pkgs.zsh-history ]; 12 + programs.zsh.interactiveShellInit = '' 13 + source ${pkgs.zsh-history.out}/share/zsh/init.zsh 14 + ''; 15 + users.users.root.shell = "${pkgs.zsh}/bin/zsh"; 16 + }; 17 + 18 + testScript = '' 19 + start_all() 20 + default.wait_for_unit("multi-user.target") 21 + default.wait_until_succeeds("pgrep -f 'agetty.*tty1'") 22 + 23 + # Login 24 + default.wait_until_tty_matches(1, "login: ") 25 + default.send_chars("root\n") 26 + default.wait_until_tty_matches(1, "root@default>") 27 + 28 + # Generate some history 29 + default.send_chars("echo foobar\n") 30 + default.wait_until_tty_matches(1, "foobar") 31 + 32 + # Ensure that command was recorded in history 33 + default.succeed("/run/current-system/sw/bin/history list | grep -q foobar") 34 + ''; 35 + })
+5 -1
pkgs/shells/zsh/zsh-history/default.nix
··· 1 - { lib, fetchFromGitHub, buildGoModule, installShellFiles }: 1 + { lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests }: 2 2 3 3 buildGoModule rec { 4 4 pname = "zsh-history"; ··· 28 28 homepage = https://github.com/b4b4r07/history; 29 29 platforms = platforms.unix; 30 30 maintainers = with maintainers; [ kampka ]; 31 + }; 32 + 33 + passthru.tests = { 34 + zsh-history-shell-integration = nixosTests.zsh-history; 31 35 }; 32 36 }