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