summary refs log tree commit diff
path: root/nixos/tests/nginx.nix
diff options
context:
space:
mode:
authorSusan Potter <me@susanpotter.net>2017-02-28 09:15:20 -0600
committerSusan Potter <me@susanpotter.net>2017-02-28 09:36:56 -0600
commit251b9ca0e77963c48d9c198cec964f7a1cd91d4a (patch)
tree6b0ef40ed516af13694ce43d05a7dadc21dea195 /nixos/tests/nginx.nix
parente0b04b4c37cbdad66491f5ac018166a6d1e100e2 (diff)
downloadnixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.tar
nixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.tar.gz
nixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.tar.bz2
nixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.tar.lz
nixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.tar.xz
nixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.tar.zst
nixpkgs-251b9ca0e77963c48d9c198cec964f7a1cd91d4a.zip
nginx service: add commonHttpConfig option
Diffstat (limited to 'nixos/tests/nginx.nix')
-rw-r--r--nixos/tests/nginx.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixos/tests/nginx.nix b/nixos/tests/nginx.nix
new file mode 100644
index 00000000000..c2beb5590ef
--- /dev/null
+++ b/nixos/tests/nginx.nix
@@ -0,0 +1,42 @@
+# verifies:
+#   1. nginx generates config file with shared http context definitions above
+#      generated virtual hosts config.
+
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "jenkins";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ mbbx6spp ];
+  };
+
+  nodes = {
+    webserver =
+      { config, pkgs, ... }:
+      { services.nginx.enable = true;
+        services.nginx.commonHttpConfig = ''
+        log_format ceeformat '@cee: {"status":"$status",'
+          '"request_time":$request_time,'
+          '"upstream_response_time":$upstream_response_time,'
+          '"pipe":"$pipe","bytes_sent":$bytes_sent,'
+          '"connection":"$connection",'
+          '"remote_addr":"$remote_addr",'
+          '"host":"$host",'
+          '"timestamp":"$time_iso8601",'
+          '"request":"$request",'
+          '"http_referer":"$http_referer",'
+          '"upstream_addr":"$upstream_addr"}';
+        '';
+        services.nginx.virtualHosts."0.my.test" = {
+          extraConfig = ''
+            access_log syslog:server=unix:/dev/log,facility=user,tag=mytag,severity=info ceeformat;
+          '';
+        };
+      };
+  };
+
+  testScript = ''
+    startAll;
+
+    $webserver->waitForUnit("nginx");
+    $webserver->waitForOpenPort("80");
+  '';
+})