summary refs log blame commit diff
path: root/nixos/tests/nginx-variants.nix
blob: 0faa0127669dd7f425b5179ab07e81c21d566667 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                               
                                          














                                                                           
                                                                                         
 
{ 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}";

          nodes.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" "nginxMainline" "nginxQuic" "nginxShibboleth" "openresty" "tengine" ]
)