diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 9e80e2cae6d1..8dbaf86f8d68 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1266,7 +1266,7 @@ in stunnel = handleTest ./stunnel.nix { }; sudo = handleTest ./sudo.nix { }; sudo-rs = runTest ./sudo-rs.nix; - sunshine = handleTest ./sunshine.nix { }; + sunshine = runTest ./sunshine.nix; suricata = handleTest ./suricata.nix { }; suwayomi-server = handleTest ./suwayomi-server.nix { }; swap-file-btrfs = handleTest ./swap-file-btrfs.nix { }; diff --git a/nixos/tests/sunshine.nix b/nixos/tests/sunshine.nix index d492a85f90d7..176b7aa9f307 100644 --- a/nixos/tests/sunshine.nix +++ b/nixos/tests/sunshine.nix @@ -1,81 +1,79 @@ -import ./make-test-python.nix ( - { pkgs, lib, ... }: - { - name = "sunshine"; - meta = { - # test is flaky on aarch64 - broken = pkgs.stdenv.hostPlatform.isAarch64; - maintainers = [ lib.maintainers.devusb ]; - timeout = 600; +{ pkgs, lib, ... }: +{ + name = "sunshine"; + meta = { + # test is flaky on aarch64 + broken = pkgs.stdenv.hostPlatform.isAarch64; + maintainers = [ lib.maintainers.devusb ]; + timeout = 600; + }; + + nodes.sunshine = + { config, pkgs, ... }: + { + imports = [ + ./common/x11.nix + ]; + + services.sunshine = { + enable = true; + openFirewall = true; + settings = { + capture = "x11"; + encoder = "software"; + output_name = 0; + }; + }; + + environment.systemPackages = with pkgs; [ + gxmessage + ]; + }; - nodes.sunshine = - { config, pkgs, ... }: - { - imports = [ - ./common/x11.nix - ]; + nodes.moonlight = + { config, pkgs, ... }: + { + imports = [ + ./common/x11.nix + ]; - services.sunshine = { - enable = true; - openFirewall = true; - settings = { - capture = "x11"; - encoder = "software"; - output_name = 0; - }; - }; + environment.systemPackages = with pkgs; [ + moonlight-qt + ]; - environment.systemPackages = with pkgs; [ - gxmessage - ]; + }; - }; + enableOCR = true; - nodes.moonlight = - { config, pkgs, ... }: - { - imports = [ - ./common/x11.nix - ]; + testScript = '' + # start the tests, wait for sunshine to be up + start_all() + sunshine.wait_for_open_port(48010,"localhost") - environment.systemPackages = with pkgs; [ - moonlight-qt - ]; + # set the admin username/password, restart sunshine + sunshine.execute("sunshine --creds sunshine sunshine") + sunshine.systemctl("restart sunshine","root") + sunshine.wait_for_open_port(48010,"localhost") - }; + # initiate pairing from moonlight + moonlight.execute("moonlight pair sunshine --pin 1234 >&2 & disown") + moonlight.wait_for_console_text("Executing request.*pair") - enableOCR = true; + # respond to pairing request from sunshine + sunshine.succeed("curl --fail --insecure -u sunshine:sunshine -d '{\"pin\":\"1234\",\"name\":\"1234\"}' https://localhost:47990/api/pin") - testScript = '' - # start the tests, wait for sunshine to be up - start_all() - sunshine.wait_for_open_port(48010,"localhost") + # wait until pairing is complete + moonlight.wait_for_console_text("Executing request.*phrase=pairchallenge") - # set the admin username/password, restart sunshine - sunshine.execute("sunshine --creds sunshine sunshine") - sunshine.systemctl("restart sunshine","root") - sunshine.wait_for_open_port(48010,"localhost") + # hide icewm panel + sunshine.send_key("ctrl-alt-h") + # put words on the sunshine screen for moonlight to see + sunshine.execute("gxmessage ' ABC' -center -font 'consolas 100' -fg '#FFFFFF' -bg '#000000' -borderless -geometry '2000x2000' -buttons \"\" >&2 & disown") - # initiate pairing from moonlight - moonlight.execute("moonlight pair sunshine --pin 1234 >&2 & disown") - moonlight.wait_for_console_text("Executing request.*pair") - - # respond to pairing request from sunshine - sunshine.succeed("curl --fail --insecure -u sunshine:sunshine -d '{\"pin\":\"1234\",\"name\":\"1234\"}' https://localhost:47990/api/pin") - - # wait until pairing is complete - moonlight.wait_for_console_text("Executing request.*phrase=pairchallenge") - - # hide icewm panel - sunshine.send_key("ctrl-alt-h") - # put words on the sunshine screen for moonlight to see - sunshine.execute("gxmessage ' ABC' -center -font 'consolas 100' -fg '#FFFFFF' -bg '#000000' -borderless -geometry '2000x2000' -buttons \"\" >&2 & disown") - - # connect to sunshine from moonlight and look for the words - moonlight.execute("moonlight --video-decoder software stream sunshine 'Desktop' >&2 & disown") - moonlight.wait_for_console_text("Dropping window event during flush") - moonlight.wait_for_text("ABC") - ''; - } -) + # connect to sunshine from moonlight and look for the words + moonlight.execute("moonlight --video-decoder software stream sunshine 'Desktop' >&2 & disown") + moonlight.wait_for_console_text("Dropping window event during flush") + moonlight.wait_for_text("ABC") + ''; +}