about summary refs log tree commit diff
path: root/nixos/tests/tandoor-recipes.nix
diff options
context:
space:
mode:
authorBruno BELANYI <bruno@belanyi.fr>2022-09-17 16:36:39 +0200
committerBruno BELANYI <bruno@belanyi.fr>2022-10-03 09:48:54 +0200
commit91ba8464f472250ffebff579a16288321b6ca302 (patch)
tree212078a4bb97985689a7ae68c8e9e44c92a22994 /nixos/tests/tandoor-recipes.nix
parentd8b1d3480664e226f3d39fa4bae846131f8b9382 (diff)
nixos/tandoor-recipes: add test
Diffstat (limited to 'nixos/tests/tandoor-recipes.nix')
-rw-r--r--nixos/tests/tandoor-recipes.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/tests/tandoor-recipes.nix b/nixos/tests/tandoor-recipes.nix
new file mode 100644
index 0000000000000..54456238fe634
--- /dev/null
+++ b/nixos/tests/tandoor-recipes.nix
@@ -0,0 +1,43 @@
+import ./make-test-python.nix ({ lib, ... }: {
+  name = "tandoor-recipes";
+  meta.maintainers = with lib.maintainers; [ ambroisie ];
+
+  nodes.machine = { pkgs, ... }: {
+    # Setup using Postgres
+    services.tandoor-recipes = {
+      enable = true;
+
+      extraConfig = {
+        DB_ENGINE = "django.db.backends.postgresql";
+        POSTGRES_HOST = "/run/postgresql";
+        POSTGRES_USER = "tandoor_recipes";
+        POSTGRES_DB = "tandoor_recipes";
+      };
+    };
+
+    services.postgresql = {
+      enable = true;
+      ensureDatabases = [ "tandoor_recipes" ];
+      ensureUsers = [
+        {
+          name = "tandoor_recipes";
+          ensurePermissions."DATABASE tandoor_recipes" = "ALL PRIVILEGES";
+        }
+      ];
+    };
+
+    systemd.services = {
+      tandoor-recipes = {
+        after = [ "postgresql.service" ];
+      };
+    };
+  };
+
+  testScript = ''
+    machine.wait_for_unit("tandoor-recipes.service")
+
+    with subtest("Web interface gets ready"):
+        # Wait until server accepts connections
+        machine.wait_until_succeeds("curl -fs localhost:8080")
+  '';
+})