Skip to content

Commit eb3ca1d

Browse files
authored
nixosTests.starship: migrate to runTest (NixOS#396019)
2 parents 249b8ed + d86c274 commit eb3ca1d

File tree

2 files changed

+49
-51
lines changed

2 files changed

+49
-51
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ in
12021202
sssd-ldap = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd-ldap.nix { };
12031203
stalwart-mail = handleTest ./stalwart-mail.nix { };
12041204
stargazer = runTest ./web-servers/stargazer.nix;
1205-
starship = handleTest ./starship.nix { };
1205+
starship = runTest ./starship.nix;
12061206
stash = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./stash.nix { };
12071207
static-web-server = handleTest ./web-servers/static-web-server.nix { };
12081208
step-ca = handleTestOn [ "x86_64-linux" ] ./step-ca.nix { };

nixos/tests/starship.nix

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,51 @@
1-
import ./make-test-python.nix (
2-
{ pkgs, ... }:
3-
{
4-
name = "starship";
5-
meta.maintainers = pkgs.starship.meta.maintainers;
6-
7-
nodes.machine = {
8-
programs = {
9-
fish.enable = true;
10-
zsh.enable = true;
11-
12-
starship = {
13-
enable = true;
14-
settings.format = "<starship>";
15-
};
1+
{ pkgs, ... }:
2+
{
3+
name = "starship";
4+
meta.maintainers = pkgs.starship.meta.maintainers;
5+
6+
nodes.machine = {
7+
programs = {
8+
fish.enable = true;
9+
zsh.enable = true;
10+
11+
starship = {
12+
enable = true;
13+
settings.format = "<starship>";
1614
};
17-
18-
environment.systemPackages =
19-
map
20-
(
21-
shell:
22-
pkgs.writeScriptBin "expect-${shell}" ''
23-
#!${pkgs.expect}/bin/expect -f
24-
25-
spawn env TERM=xterm ${shell} -i
26-
27-
expect "<starship>" {
28-
send "exit\n"
29-
} timeout {
30-
send_user "\n${shell} failed to display Starship\n"
31-
exit 1
32-
}
33-
34-
expect eof
35-
''
36-
)
37-
[
38-
"bash"
39-
"fish"
40-
"zsh"
41-
];
4215
};
4316

44-
testScript = ''
45-
start_all()
46-
machine.wait_for_unit("default.target")
47-
48-
machine.succeed("expect-bash")
49-
machine.succeed("expect-fish")
50-
machine.succeed("expect-zsh")
51-
'';
52-
}
53-
)
17+
environment.systemPackages =
18+
map
19+
(
20+
shell:
21+
pkgs.writeScriptBin "expect-${shell}" ''
22+
#!${pkgs.expect}/bin/expect -f
23+
24+
spawn env TERM=xterm ${shell} -i
25+
26+
expect "<starship>" {
27+
send "exit\n"
28+
} timeout {
29+
send_user "\n${shell} failed to display Starship\n"
30+
exit 1
31+
}
32+
33+
expect eof
34+
''
35+
)
36+
[
37+
"bash"
38+
"fish"
39+
"zsh"
40+
];
41+
};
42+
43+
testScript = ''
44+
start_all()
45+
machine.wait_for_unit("default.target")
46+
47+
machine.succeed("expect-bash")
48+
machine.succeed("expect-fish")
49+
machine.succeed("expect-zsh")
50+
'';
51+
}

0 commit comments

Comments
 (0)