From d86c274b99b9c40ac54e0423cc99e9ab44105497 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:23:09 +0200 Subject: [PATCH] nixosTests.starship: migrate to runTest Part of #386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/starship.nix | 92 +++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 48 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 9ee7f01fef1b..c4928d9e52e5 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 { }; diff --git a/nixos/tests/starship.nix b/nixos/tests/starship.nix index 23e103fc000e..382666d8f176 100644 --- a/nixos/tests/starship.nix +++ b/nixos/tests/starship.nix @@ -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 = { + enable = true; + settings.format = ""; }; - - environment.systemPackages = - map - ( - shell: - pkgs.writeScriptBin "expect-${shell}" '' - #!${pkgs.expect}/bin/expect -f - - spawn env TERM=xterm ${shell} -i - - expect "" { - 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 "" { + 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") + ''; +}