blob: 9dcdeec9d8c8fc5e29992265e321d4bb81d6e6de (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
{
system ? builtins.currentSystem
, pkgs ? import ../.. { inherit system; }
, package
}:
import ./make-test-python.nix ({ pkgs, ... }: let
testPath = pkgs.hello;
in {
name = "varnish";
meta = with pkgs.lib.maintainers; {
maintainers = [ ajs124 ];
};
nodes = {
varnish = { config, pkgs, ... }: {
services.nix-serve = {
enable = true;
};
services.varnish = {
inherit package;
enable = true;
http_address = "0.0.0.0:80";
config = ''
vcl 4.0;
backend nix-serve {
.host = "127.0.0.1";
.port = "${toString config.services.nix-serve.port}";
}
'';
};
networking.firewall.allowedTCPPorts = [ 80 ];
system.extraDependencies = [ testPath ];
};
client = { lib, ... }: {
nix.settings = {
require-sigs = false;
substituters = lib.mkForce [ "http://varnish" ];
};
};
};
testScript = ''
start_all()
varnish.wait_for_open_port(80)
client.wait_until_succeeds("curl -f http://varnish/nix-cache-info");
client.wait_until_succeeds("nix-store -r ${testPath}");
client.succeed("${testPath}/bin/hello");
'';
})
|