1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-02-17 00:10:30 +00:00

Merge pull request #62133 from LnL7/nixos-uwsgi

nixos: add test for uwsgi
This commit is contained in:
Daiderd Jordan 2019-06-08 11:25:51 +02:00 committed by GitHub
commit 9b52ff5335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View file

@ -248,6 +248,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 {};

38
nixos/tests/uwsgi.nix Normal file
View file

@ -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!"');
'';
})