diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 9bce49c9e302..41ce9ebd7fd1 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -246,6 +246,7 @@ in transmission = handleTest ./transmission.nix {}; udisks2 = handleTest ./udisks2.nix {}; upnp = handleTest ./upnp.nix {}; + uwsgi = handleTest ./uwsgi.nix {}; vault = handleTest ./vault.nix {}; virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {}; wireguard = handleTest ./wireguard {}; diff --git a/nixos/tests/uwsgi.nix b/nixos/tests/uwsgi.nix new file mode 100644 index 000000000000..afc03e74ed7e --- /dev/null +++ b/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!"'); + ''; +})