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;
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
'';
};
}