fix: replace VM test with runCommand smoke test (no KVM in CI)
Some checks failed
Build and Push static-server Image / build (push) Failing after 46s

This commit is contained in:
Christopher Mühl 2026-02-18 13:41:44 +01:00
parent b094952455
commit b6a9eb1e84
No known key found for this signature in database
GPG key ID: 925AC7D69955293F

View file

@ -29,27 +29,27 @@
{ {
packages.${system}.staticServer = staticServer; packages.${system}.staticServer = staticServer;
checks.${system}.smoke = pkgs.testers.nixosTest { checks.${system}.smoke = pkgs.runCommand "static-server-smoke" {
name = "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 = { ... }: { static-web-server --port 18080 --root $TMPDIR/www &
virtualisation.docker.enable = true; SERVER_PID=$!
}; trap "kill $SERVER_PID" EXIT
testScript = '' # wait for server to be ready
machine.start() for i in $(seq 1 10); do
machine.wait_for_unit("docker.service") curl -sf http://localhost:18080/ && break
machine.succeed("docker load < ${staticServer}") sleep 0.5
machine.succeed( done
"docker run -d --name site -p 8080:8080 static-server:latest"
" /bin/bash -c 'mkdir -p /var/www" curl -sf http://localhost:18080/ | grep -q index
" && printf index > /var/www/index.html" curl -sf http://localhost:18080/foo | grep -q foo
" && printf foo > /var/www/foo.html"
" && exec static-web-server --port 8080 --root /var/www'" touch $out
)
machine.wait_until_succeeds("curl -sf http://localhost:8080/")
machine.succeed("curl -sf http://localhost:8080/foo | grep -q foo")
''; '';
}; };
};
} }