From ca409e5a02e76b05fe244be6d72b941415765600 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 14 Mar 2025 23:38:25 +0100 Subject: [PATCH] nixosTests.xandikos: migrate to runTest Part Of #386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/xandikos.nix | 124 +++++++++++++++++++------------------- 2 files changed, 62 insertions(+), 64 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 866ed2170237..85f8eae7ebac 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1285,7 +1285,7 @@ in { wrappers = handleTest ./wrappers.nix {}; writefreely = handleTest ./web-apps/writefreely.nix {}; wstunnel = runTest ./wstunnel.nix; - xandikos = handleTest ./xandikos.nix {}; + xandikos = runTest ./xandikos.nix; xautolock = runTest ./xautolock.nix; xfce = runTest ./xfce.nix; xfce-wayland = runTest ./xfce-wayland.nix; diff --git a/nixos/tests/xandikos.nix b/nixos/tests/xandikos.nix index 4905a5bc067d..5952009c1e00 100644 --- a/nixos/tests/xandikos.nix +++ b/nixos/tests/xandikos.nix @@ -1,73 +1,71 @@ -import ./make-test-python.nix ( - { pkgs, lib, ... }: +{ lib, ... }: - { - name = "xandikos"; +{ + name = "xandikos"; - meta.maintainers = with lib.maintainers; [ _0x4A6F ]; + meta.maintainers = with lib.maintainers; [ _0x4A6F ]; - nodes = { - xandikos_client = { }; - xandikos_default = { - networking.firewall.allowedTCPPorts = [ 8080 ]; - services.xandikos.enable = true; - }; - xandikos_proxy = { - networking.firewall.allowedTCPPorts = [ - 80 - 8080 - ]; - services.xandikos.enable = true; - services.xandikos.address = "localhost"; - services.xandikos.port = 8080; - services.xandikos.routePrefix = "/xandikos-prefix/"; - services.xandikos.extraOptions = [ - "--defaults" - ]; - services.nginx = { - enable = true; - recommendedProxySettings = true; - virtualHosts."xandikos" = { - serverName = "xandikos.local"; - basicAuth.xandikos = "snakeOilPassword"; - locations."/xandikos/" = { - proxyPass = "http://localhost:8080/xandikos-prefix/"; - }; + nodes = { + xandikos_client = { }; + xandikos_default = { + networking.firewall.allowedTCPPorts = [ 8080 ]; + services.xandikos.enable = true; + }; + xandikos_proxy = { + networking.firewall.allowedTCPPorts = [ + 80 + 8080 + ]; + services.xandikos.enable = true; + services.xandikos.address = "localhost"; + services.xandikos.port = 8080; + services.xandikos.routePrefix = "/xandikos-prefix/"; + services.xandikos.extraOptions = [ + "--defaults" + ]; + services.nginx = { + enable = true; + recommendedProxySettings = true; + virtualHosts."xandikos" = { + serverName = "xandikos.local"; + basicAuth.xandikos = "snakeOilPassword"; + locations."/xandikos/" = { + proxyPass = "http://localhost:8080/xandikos-prefix/"; }; }; }; }; + }; - testScript = '' - start_all() + testScript = '' + start_all() - with subtest("Xandikos default"): - xandikos_default.wait_for_unit("multi-user.target") - xandikos_default.wait_for_unit("xandikos.service") - xandikos_default.wait_for_open_port(8080) - xandikos_default.succeed("curl --fail http://localhost:8080/") - xandikos_default.succeed( - "curl -s --fail --location http://localhost:8080/ | grep -i Xandikos" - ) - xandikos_client.wait_for_unit("network.target") - xandikos_client.fail("curl --fail http://xandikos_default:8080/") + with subtest("Xandikos default"): + xandikos_default.wait_for_unit("multi-user.target") + xandikos_default.wait_for_unit("xandikos.service") + xandikos_default.wait_for_open_port(8080) + xandikos_default.succeed("curl --fail http://localhost:8080/") + xandikos_default.succeed( + "curl -s --fail --location http://localhost:8080/ | grep -i Xandikos" + ) + xandikos_client.wait_for_unit("network.target") + xandikos_client.fail("curl --fail http://xandikos_default:8080/") - with subtest("Xandikos proxy"): - xandikos_proxy.wait_for_unit("multi-user.target") - xandikos_proxy.wait_for_unit("xandikos.service") - xandikos_proxy.wait_for_open_port(8080) - xandikos_proxy.succeed("curl --fail http://localhost:8080/") - xandikos_proxy.succeed( - "curl -s --fail --location http://localhost:8080/ | grep -i Xandikos" - ) - xandikos_client.wait_for_unit("network.target") - xandikos_client.fail("curl --fail http://xandikos_proxy:8080/") - xandikos_client.succeed( - "curl -s --fail -u xandikos:snakeOilPassword -H 'Host: xandikos.local' http://xandikos_proxy/xandikos/ | grep -i Xandikos" - ) - xandikos_client.succeed( - "curl -s --fail -u xandikos:snakeOilPassword -H 'Host: xandikos.local' http://xandikos_proxy/xandikos/user/ | grep -i Xandikos" - ) - ''; - } -) + with subtest("Xandikos proxy"): + xandikos_proxy.wait_for_unit("multi-user.target") + xandikos_proxy.wait_for_unit("xandikos.service") + xandikos_proxy.wait_for_open_port(8080) + xandikos_proxy.succeed("curl --fail http://localhost:8080/") + xandikos_proxy.succeed( + "curl -s --fail --location http://localhost:8080/ | grep -i Xandikos" + ) + xandikos_client.wait_for_unit("network.target") + xandikos_client.fail("curl --fail http://xandikos_proxy:8080/") + xandikos_client.succeed( + "curl -s --fail -u xandikos:snakeOilPassword -H 'Host: xandikos.local' http://xandikos_proxy/xandikos/ | grep -i Xandikos" + ) + xandikos_client.succeed( + "curl -s --fail -u xandikos:snakeOilPassword -H 'Host: xandikos.local' http://xandikos_proxy/xandikos/user/ | grep -i Xandikos" + ) + ''; +}