nixosTests.starship: migrate to runTest (#396019)

This commit is contained in:
Pol Dellaiera
2025-04-04 19:10:23 +02:00
committed by GitHub
2 changed files with 46 additions and 48 deletions
+1 -1
View File
@@ -1202,7 +1202,7 @@ in
sssd-ldap = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd-ldap.nix { };
stalwart-mail = handleTest ./stalwart-mail.nix { };
stargazer = runTest ./web-servers/stargazer.nix;
starship = handleTest ./starship.nix { };
starship = runTest ./starship.nix;
stash = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./stash.nix { };
static-web-server = handleTest ./web-servers/static-web-server.nix { };
step-ca = handleTestOn [ "x86_64-linux" ] ./step-ca.nix { };
+45 -47
View File
@@ -1,53 +1,51 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
name = "starship";
meta.maintainers = pkgs.starship.meta.maintainers;
{ pkgs, ... }:
{
name = "starship";
meta.maintainers = pkgs.starship.meta.maintainers;
nodes.machine = {
programs = {
fish.enable = true;
zsh.enable = true;
nodes.machine = {
programs = {
fish.enable = true;
zsh.enable = true;
starship = {
enable = true;
settings.format = "<starship>";
};
starship = {
enable = true;
settings.format = "<starship>";
};
environment.systemPackages =
map
(
shell:
pkgs.writeScriptBin "expect-${shell}" ''
#!${pkgs.expect}/bin/expect -f
spawn env TERM=xterm ${shell} -i
expect "<starship>" {
send "exit\n"
} timeout {
send_user "\n${shell} failed to display Starship\n"
exit 1
}
expect eof
''
)
[
"bash"
"fish"
"zsh"
];
};
testScript = ''
start_all()
machine.wait_for_unit("default.target")
environment.systemPackages =
map
(
shell:
pkgs.writeScriptBin "expect-${shell}" ''
#!${pkgs.expect}/bin/expect -f
machine.succeed("expect-bash")
machine.succeed("expect-fish")
machine.succeed("expect-zsh")
'';
}
)
spawn env TERM=xterm ${shell} -i
expect "<starship>" {
send "exit\n"
} timeout {
send_user "\n${shell} failed to display Starship\n"
exit 1
}
expect eof
''
)
[
"bash"
"fish"
"zsh"
];
};
testScript = ''
start_all()
machine.wait_for_unit("default.target")
machine.succeed("expect-bash")
machine.succeed("expect-fish")
machine.succeed("expect-zsh")
'';
}