53 lines
1.5 KiB
Nix
53 lines
1.5 KiB
Nix
let
|
|
sources = import ./npins;
|
|
inherit (sources) nixpkgs;
|
|
pkgs = import nixpkgs { overlays = [ (import ./pkgs/overlay.nix) ]; };
|
|
inherit (pkgs) hello;
|
|
in
|
|
pkgs.testers.runNixOSTest (_: {
|
|
name = "cache smoke test";
|
|
nodes.machine =
|
|
{ config, ... }:
|
|
{
|
|
imports = [ ./modules ];
|
|
|
|
system.extraDependencies = [ hello ];
|
|
|
|
services.tvix-binary-cache.enable = true;
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedProxySettings = true;
|
|
virtualHosts.cachix = {
|
|
default = true;
|
|
locations."/" = {
|
|
proxyPass = "http://localhost:${toString config.services.tvix-binary-cache.port}";
|
|
extraConfig = ''
|
|
client_max_body_size 10G;
|
|
'';
|
|
};
|
|
|
|
};
|
|
};
|
|
};
|
|
testScript = ''
|
|
import sys
|
|
import time
|
|
start_all()
|
|
machine.wait_for_unit("tvix-store.service")
|
|
machine.wait_for_unit("nginx.service")
|
|
machine.wait_for_unit("nar-bridge.service")
|
|
time.sleep(1)
|
|
with subtest("Nar bridge home"):
|
|
out = machine.succeed("curl http://127.0.0.1/")
|
|
print(repr(out))
|
|
if out != "nar-bridge":
|
|
sys.exit(1)
|
|
with subtest("Nar upload"):
|
|
machine.succeed("nix copy --extra-experimental-features nix-command --to 'http://127.0.0.1/?compression=none' ${hello}")
|
|
with subtest("narinfo retrieve"):
|
|
narHash = "${hello}"[11:11+32]
|
|
machine.succeed("curl 'http://127.0.0.1/{narHash}.narinfo'")
|
|
|
|
'';
|
|
})
|