From b6a9eb1e84620798355309a80fb524156ae10081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=BChl?= Date: Wed, 18 Feb 2026 13:41:44 +0100 Subject: [PATCH] fix: replace VM test with runCommand smoke test (no KVM in CI) --- deploy-static-site/images/flake.nix | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/deploy-static-site/images/flake.nix b/deploy-static-site/images/flake.nix index 3c47e65..1115b2d 100644 --- a/deploy-static-site/images/flake.nix +++ b/deploy-static-site/images/flake.nix @@ -29,27 +29,27 @@ { packages.${system}.staticServer = staticServer; - checks.${system}.smoke = pkgs.testers.nixosTest { - name = "static-server-smoke"; + checks.${system}.smoke = pkgs.runCommand "static-server-smoke" { + nativeBuildInputs = with pkgs; [ static-web-server curl ]; + } '' + mkdir -p $TMPDIR/www + printf index > $TMPDIR/www/index.html + printf foo > $TMPDIR/www/foo.html - nodes.machine = { ... }: { - virtualisation.docker.enable = true; - }; + static-web-server --port 18080 --root $TMPDIR/www & + SERVER_PID=$! + trap "kill $SERVER_PID" EXIT - testScript = '' - machine.start() - machine.wait_for_unit("docker.service") - machine.succeed("docker load < ${staticServer}") - machine.succeed( - "docker run -d --name site -p 8080:8080 static-server:latest" - " /bin/bash -c 'mkdir -p /var/www" - " && printf index > /var/www/index.html" - " && printf foo > /var/www/foo.html" - " && exec static-web-server --port 8080 --root /var/www'" - ) - machine.wait_until_succeeds("curl -sf http://localhost:8080/") - machine.succeed("curl -sf http://localhost:8080/foo | grep -q foo") - ''; - }; + # wait for server to be ready + for i in $(seq 1 10); do + curl -sf http://localhost:18080/ && break + sleep 0.5 + done + + curl -sf http://localhost:18080/ | grep -q index + curl -sf http://localhost:18080/foo | grep -q foo + + touch $out + ''; }; }