about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/uwsgi.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-06-12 09:59:45 +0000
committerAlyssa Ross <hi@alyssa.is>2019-06-18 18:14:17 +0000
commitc5571a126859eb658ffd7340cb580f7d91f12bb6 (patch)
tree577573c3bf14d9849246d52daece719a10eaf138 /nixpkgs/nixos/tests/uwsgi.nix
parent828bd4e8ddcbcd354ddfd99f55af69ee8ff5d9e7 (diff)
parent98e3b90b6c8f400ae5438ef868eb992a64b75ce5 (diff)
downloadnixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar
nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.gz
nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.bz2
nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.lz
nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.xz
nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.zst
nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.zip
Merge commit '98e3b90b6c8f400ae5438ef868eb992a64b75ce5'
Diffstat (limited to 'nixpkgs/nixos/tests/uwsgi.nix')
-rw-r--r--nixpkgs/nixos/tests/uwsgi.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/uwsgi.nix b/nixpkgs/nixos/tests/uwsgi.nix
new file mode 100644
index 000000000000..afc03e74ed7e
--- /dev/null
+++ b/nixpkgs/nixos/tests/uwsgi.nix
@@ -0,0 +1,38 @@
+import ./make-test.nix ({ pkgs, ... }:
+{
+  name = "uwsgi";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ lnl7 ];
+  };
+  machine = { pkgs, ... }: {
+    services.uwsgi.enable = true;
+    services.uwsgi.plugins = [ "python3" ];
+    services.uwsgi.instance = {
+      type = "emperor";
+      vassals.hello = {
+        type = "normal";
+        master = true;
+        workers = 2;
+        http = ":8000";
+        module = "wsgi:application";
+        chdir = pkgs.writeTextDir "wsgi.py" ''
+          from flask import Flask
+          application = Flask(__name__)
+
+          @application.route("/")
+          def hello():
+              return "Hello World!"
+        '';
+        pythonPackages = self: with self; [ flask ];
+      };
+    };
+  };
+
+  testScript =
+    ''
+      $machine->waitForUnit('multi-user.target');
+      $machine->waitForUnit('uwsgi.service');
+      $machine->waitForOpenPort(8000);
+      $machine->succeed('curl -v 127.0.0.1:8000 | grep "Hello World!"');
+    '';
+})