54 lines
1.3 KiB
Nix
54 lines
1.3 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 time
|
|
start_all()
|
|
machine.wait_for_unit("nginx.service")
|
|
machine.wait_for_unit("tvix-store-one.service")
|
|
machine.wait_for_unit("tvix-store-two.service")
|
|
time.sleep(1)
|
|
with subtest("Nar bridge home"):
|
|
machine.succeed("curl -L http://127.0.0.1/one/nix-cache-info")
|
|
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'")
|
|
'';
|
|
})
|