fish: fix passthru tests for darwin

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
This commit is contained in:
Muhammad Falak R Wani 2024-03-20 10:24:40 +05:30 committed by Adam Stephens
parent ce9d71e62b
commit f3a20533b7
No known key found for this signature in database

View file

@ -308,7 +308,7 @@ let
passthru = {
shellPath = "/bin/fish";
tests = {
nixos = nixosTests.fish;
nixos = lib.optionalAttrs stdenv.isLinux nixosTests.fish;
# Test the fish_config tool by checking the generated splash page.
# Since the webserver requires a port to run, it is not started.
@ -322,18 +322,17 @@ let
# if we don't set `delete=False`, the file will get cleaned up
# automatically (leading the test to fail because there's no
# tempfile to check)
sed -e 's@, mode="w"@, mode="w", delete=False@' -i webconfig.py
${lib.getExe gnused} -e 's@, mode="w"@, mode="w", delete=False@' -i webconfig.py
# we delete everything after the fileurl is assigned
sed -e '/fileurl =/q' -i webconfig.py
${lib.getExe gnused} -e '/fileurl =/q' -i webconfig.py
echo "print(fileurl)" >> webconfig.py
# and check whether the message appears on the page
cat (${python3}/bin/python ./webconfig.py \
| tail -n1 | sed -ne 's|.*\(/build/.*\)|\1|p' \
) | grep 'a href="http://localhost.*Start the Fish Web config'
# cannot test the http server because it needs a localhost port
cat (${python3}/bin/python ./webconfig.py \
| tail -n1 | ${lib.getExe gnused} -e 's|file://||' \
) | ${lib.getExe gnugrep} -q 'a href="http://localhost.*Start the Fish Web config'
'';
in
runCommand "test-web-config" { } ''