about summary refs log tree commit diff
path: root/nixos/tests/nginx-variants.nix
diff options
context:
space:
mode:
authorJamie McClymont <jamie@kwiius.com>2020-06-02 17:01:03 +1200
committerJamie McClymont <jamie@kwiius.com>2020-06-02 21:55:48 +1200
commit44007dec5c96dbfa3aa2aa5850a4c05804eae38e (patch)
treee6521cc63ae499ad1fa6b1aafe3d04d9f110db12 /nixos/tests/nginx-variants.nix
parent85760026a07d321f8f5dfd1b5363128e8c567dc5 (diff)
nixos/nginx: ensure all variants have a basic level of testing
Diffstat (limited to 'nixos/tests/nginx-variants.nix')
-rw-r--r--nixos/tests/nginx-variants.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixos/tests/nginx-variants.nix b/nixos/tests/nginx-variants.nix
new file mode 100644
index 0000000000000..ca4655391bc59
--- /dev/null
+++ b/nixos/tests/nginx-variants.nix
@@ -0,0 +1,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" ]
+)