1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/tests/uwsgi.nix

53 lines
1.4 KiB
Nix
Raw Normal View History

2019-11-24 18:12:14 +00:00
import ./make-test-python.nix ({ pkgs, ... }:
2019-05-27 22:03:22 +01:00
{
name = "uwsgi";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ lnl7 ];
};
2020-12-20 23:22:29 +00:00
2019-05-27 22:03:22 +01:00
machine = { pkgs, ... }: {
services.uwsgi.enable = true;
2020-12-20 23:22:29 +00:00
services.uwsgi.plugins = [ "python3" "php" ];
2019-05-27 22:03:22 +01:00
services.uwsgi.instance = {
type = "emperor";
2020-12-20 23:22:29 +00:00
vassals.python = {
2019-05-27 22:03:22 +01:00
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 ];
};
2020-12-20 23:22:29 +00:00
vassals.php = {
type = "normal";
master = true;
workers = 2;
http-socket = ":8001";
http-socket-modifier1 = 14;
php-index = "index.php";
php-docroot = pkgs.writeTextDir "index.php" ''
<?php echo "Hello World\n"; ?>
'';
};
2019-05-27 22:03:22 +01:00
};
};
testScript =
''
2019-11-24 18:12:14 +00:00
machine.wait_for_unit("multi-user.target")
machine.wait_for_unit("uwsgi.service")
machine.wait_for_open_port(8000)
2020-12-20 23:22:29 +00:00
machine.wait_for_open_port(8001)
2020-09-16 16:19:47 +01:00
assert "Hello World" in machine.succeed("curl -fv 127.0.0.1:8000")
2020-12-20 23:22:29 +00:00
assert "Hello World" in machine.succeed("curl -fv 127.0.0.1:8001")
2019-05-27 22:03:22 +01:00
'';
})