zsh-history: Add tests
This commit is contained in:
parent
b85286fe66
commit
c98d54a3e9
|
@ -294,5 +294,6 @@ in
|
||||||
xss-lock = handleTest ./xss-lock.nix {};
|
xss-lock = handleTest ./xss-lock.nix {};
|
||||||
yabar = handleTest ./yabar.nix {};
|
yabar = handleTest ./yabar.nix {};
|
||||||
yggdrasil = handleTest ./yggdrasil.nix {};
|
yggdrasil = handleTest ./yggdrasil.nix {};
|
||||||
|
zsh-history = handleTest ./zsh-history.nix {};
|
||||||
zookeeper = handleTest ./zookeeper.nix {};
|
zookeeper = handleTest ./zookeeper.nix {};
|
||||||
}
|
}
|
||||||
|
|
35
nixos/tests/zsh-history.nix
Normal file
35
nixos/tests/zsh-history.nix
Normal file
|
@ -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")
|
||||||
|
'';
|
||||||
|
})
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
|
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests }:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "zsh-history";
|
pname = "zsh-history";
|
||||||
|
@ -29,4 +29,8 @@ buildGoModule rec {
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
maintainers = with maintainers; [ kampka ];
|
maintainers = with maintainers; [ kampka ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
zsh-history-shell-integration = nixosTests.zsh-history;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user