nixosTests.varnish{75,76,60}: migrate to runTest (#394659)

authored by Gaétan Lepage and committed by GitHub c01965bd 55bfb51d

+61 -59
+12 -3
nixos/tests/all-tests.nix
··· 1277 ustreamer = handleTest ./ustreamer.nix {}; 1278 uwsgi = handleTest ./uwsgi.nix {}; 1279 v2ray = handleTest ./v2ray.nix {}; 1280 - varnish60 = handleTest ./varnish.nix { package = pkgs.varnish60; }; 1281 - varnish75 = handleTest ./varnish.nix { package = pkgs.varnish75; }; 1282 - varnish76 = handleTest ./varnish.nix { package = pkgs.varnish76; }; 1283 vault = handleTest ./vault.nix {}; 1284 vault-agent = handleTest ./vault-agent.nix {}; 1285 vault-dev = handleTest ./vault-dev.nix {};
··· 1277 ustreamer = handleTest ./ustreamer.nix {}; 1278 uwsgi = handleTest ./uwsgi.nix {}; 1279 v2ray = handleTest ./v2ray.nix {}; 1280 + varnish60 = runTest { 1281 + imports = [ ./varnish.nix ]; 1282 + _module.args.package = pkgs.varnish60; 1283 + }; 1284 + varnish75 = runTest { 1285 + imports = [ ./varnish.nix ]; 1286 + _module.args.package = pkgs.varnish75; 1287 + }; 1288 + varnish76 = runTest { 1289 + imports = [ ./varnish.nix ]; 1290 + _module.args.package = pkgs.varnish76; 1291 + }; 1292 vault = handleTest ./vault.nix {}; 1293 vault-agent = handleTest ./vault-agent.nix {}; 1294 vault-dev = handleTest ./vault-dev.nix {};
+49 -56
nixos/tests/varnish.nix
··· 1 { 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 - }; 38 - 39 - networking.firewall.allowedTCPPorts = [ 80 ]; 40 - system.extraDependencies = [ testPath ]; 41 }; 42 43 - client = 44 - { lib, ... }: 45 - { 46 - nix.settings = { 47 - require-sigs = false; 48 - substituters = lib.mkForce [ "http://varnish" ]; 49 - }; 50 }; 51 - }; 52 53 - testScript = '' 54 - start_all() 55 - varnish.wait_for_open_port(80) 56 57 - client.wait_until_succeeds("curl -f http://varnish/nix-cache-info"); 58 59 - client.wait_until_succeeds("nix-store -r ${testPath}") 60 - client.succeed("${testPath}/bin/hello") 61 62 - output = varnish.succeed("varnishadm status") 63 - print(output) 64 - assert "Child in state running" in output, "Unexpected varnishadm response" 65 - ''; 66 - } 67 - )
··· 1 + { pkgs, package, ... }: 2 + let 3 + testPath = pkgs.hello; 4 + in 5 { 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 + }; 18 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 + ''; 31 }; 32 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" ]; 43 }; 44 + }; 45 + }; 46 47 + testScript = '' 48 + start_all() 49 + varnish.wait_for_open_port(80) 50 51 + client.wait_until_succeeds("curl -f http://varnish/nix-cache-info"); 52 53 + client.wait_until_succeeds("nix-store -r ${testPath}") 54 + client.succeed("${testPath}/bin/hello") 55 56 + output = varnish.succeed("varnishadm status") 57 + print(output) 58 + assert "Child in state running" in output, "Unexpected varnishadm response" 59 + ''; 60 + }