57 lines
1.4 KiB
Nix
57 lines
1.4 KiB
Nix
{ pkgs }:
|
|
let
|
|
inherit (pkgs) hello;
|
|
in
|
|
pkgs.testers.runNixOSTest (_: {
|
|
name = "cache multi-cache smoke test";
|
|
nodes.machine = {
|
|
imports = [
|
|
./common
|
|
../modules
|
|
];
|
|
|
|
system.extraDependencies = [ hello ];
|
|
|
|
services.tvix-binary-cache = {
|
|
enable = true;
|
|
enableNginx = true;
|
|
nginx = {
|
|
clientMaxBodySize = "50G";
|
|
host = "cache";
|
|
};
|
|
|
|
caches = {
|
|
one.port = 8000;
|
|
two.port = 8001;
|
|
};
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedProxySettings = true;
|
|
virtualHosts.cache = {
|
|
default = true;
|
|
};
|
|
};
|
|
};
|
|
testScript = ''
|
|
import sys
|
|
import time
|
|
start_all()
|
|
machine.wait_for_unit("nginx.service")
|
|
machine.wait_for_unit("nar-bridge-one.service")
|
|
machine.wait_for_unit("nar-bridge-two.service")
|
|
time.sleep(1)
|
|
with subtest("Nar bridge home"):
|
|
out = machine.succeed("curl -L http://127.0.0.1/one")
|
|
if out != "nar-bridge":
|
|
sys.exit(1)
|
|
with subtest("Nar upload"):
|
|
machine.succeed("nix copy --to 'http://127.0.0.1/one/?compression=none' ${hello}")
|
|
with subtest("narinfo retrieve"):
|
|
narHash = "${hello}"[11:11+32]
|
|
machine.succeed(f"curl -f 'http://127.0.0.1/one/{narHash}.narinfo'")
|
|
machine.fail(f"curl -f 'http://127.0.0.1/two/{narHash}.narinfo'")
|
|
|
|
'';
|
|
})
|