1import ./make-test-python.nix ({ lib, ... }: {
2 name = "tandoor-recipes";
3 meta.maintainers = with lib.maintainers; [ ambroisie ];
4
5 nodes.machine = { pkgs, ... }: {
6 services.tandoor-recipes = {
7 enable = true;
8 extraConfig = {
9 DB_ENGINE = "django.db.backends.postgresql";
10 POSTGRES_HOST = "/run/postgresql";
11 POSTGRES_USER = "tandoor_recipes";
12 POSTGRES_DB = "tandoor_recipes";
13 };
14 };
15
16 services.postgresql = {
17 enable = true;
18 ensureDatabases = [ "tandoor_recipes" ];
19 ensureUsers = [
20 {
21 name = "tandoor_recipes";
22 ensureDBOwnership = true;
23 }
24 ];
25 };
26
27 systemd.services = {
28 tandoor-recipes = {
29 after = [ "postgresql.service" ];
30 };
31 };
32 };
33
34 testScript = ''
35 machine.wait_for_unit("tandoor-recipes.service")
36
37 with subtest("Web interface gets ready"):
38 # Wait until server accepts connections
39 machine.wait_until_succeeds("curl -fs localhost:8080")
40 '';
41})