2024-07-19 10:51:57 +02:00
|
|
|
{ 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")
|
2024-07-20 18:22:43 +02:00
|
|
|
machine.wait_for_unit("tvix-store-one.service")
|
|
|
|
machine.wait_for_unit("tvix-store-two.service")
|
2024-07-19 10:51:57 +02:00
|
|
|
time.sleep(1)
|
|
|
|
with subtest("Nar bridge home"):
|
2024-07-20 18:22:43 +02:00
|
|
|
machine.succeed("curl -L http://127.0.0.1/one/nix-cache-info")
|
2024-07-19 10:51:57 +02:00
|
|
|
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'")
|
|
|
|
'';
|
|
|
|
})
|