@@ -0,0 +1,38 @@
1+import ./make-test.nix ({ pkgs, ... }:
2+{
3+ name = "uwsgi";
4+ meta = with pkgs.stdenv.lib.maintainers; {
5+ maintainers = [ lnl7 ];
6+ };
7+ machine = { pkgs, ... }: {
8+ services.uwsgi.enable = true;
9+ services.uwsgi.plugins = [ "python3" ];
10+ services.uwsgi.instance = {
11+ type = "emperor";
12+ vassals.hello = {
13+ type = "normal";
14+ master = true;
15+ workers = 2;
16+ http = ":8000";
17+ module = "wsgi:application";
18+ chdir = pkgs.writeTextDir "wsgi.py" ''
19+ from flask import Flask
20+ application = Flask(__name__)
21+
22+ @application.route("/")
23+ def hello():
24+ return "Hello World!"
25+ '';
26+ pythonPackages = self: with self; [ flask ];
27+ };
28+ };
29+ };
30+
31+ testScript =
32+ ''
33+ $machine->waitForUnit('multi-user.target');
34+ $machine->waitForUnit('uwsgi.service');
35+ $machine->waitForOpenPort(8000);
36+ $machine->succeed('curl -v 127.0.0.1:8000 | grep "Hello World!"');
37+ '';
38+})