summary refs log tree commit diff
path: root/nixos/tests/nginx-variants.nix
blob: ca4655391bc599b482f5d48b59281ae3354f822c (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
{ system ? builtins.currentSystem,
  config ? {},
  pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing-python.nix { inherit system pkgs; };

builtins.listToAttrs (
  builtins.map
    (nginxName:
      {
        name = nginxName;
        value = makeTest {
          name = "nginx-variant-${nginxName}";

          machine = { pkgs, ... }: {
            services.nginx = {
              enable = true;
              virtualHosts.localhost.locations."/".return = "200 'foo'";
              package = pkgs."${nginxName}";
            };
          };

          testScript = ''
            machine.wait_for_unit("nginx")
            machine.wait_for_open_port(80)
            machine.succeed('test "$(curl -fvvv http://localhost/)" = foo')
          '';
        };
      }
    )
    [ "nginxStable" "nginxUnstable" "nginxShibboleth" "openresty" "tengine" ]
)