python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / nixos / tests / hedgedoc.nix
blob410350d83627c093c75329601efb3520a686f085
1 import ./make-test-python.nix ({ pkgs, lib, ... }:
3   name = "hedgedoc";
5   meta = with lib.maintainers; {
6     maintainers = [ willibutz ];
7   };
9   nodes = {
10     hedgedocSqlite = { ... }: {
11       services = {
12         hedgedoc = {
13           enable = true;
14           settings.dbURL = "sqlite:///var/lib/hedgedoc/hedgedoc.db";
15         };
16       };
17     };
19     hedgedocPostgres = { ... }: {
20       systemd.services.hedgedoc.after = [ "postgresql.service" ];
21       services = {
22         hedgedoc = {
23           enable = true;
24           settings.dbURL = "postgres://hedgedoc:\${DB_PASSWORD}@localhost:5432/hedgedocdb";
26           /*
27            * Do not use pkgs.writeText for secrets as
28            * they will end up in the world-readable Nix store.
29            */
30           environmentFile = pkgs.writeText "hedgedoc-env" ''
31             DB_PASSWORD=snakeoilpassword
32           '';
33         };
34         postgresql = {
35           enable = true;
36           initialScript = pkgs.writeText "pg-init-script.sql" ''
37             CREATE ROLE hedgedoc LOGIN PASSWORD 'snakeoilpassword';
38             CREATE DATABASE hedgedocdb OWNER hedgedoc;
39           '';
40         };
41       };
42     };
43   };
45   testScript = ''
46     start_all()
48     with subtest("HedgeDoc sqlite"):
49         hedgedocSqlite.wait_for_unit("hedgedoc.service")
50         hedgedocSqlite.wait_for_open_port(3000)
51         hedgedocSqlite.wait_until_succeeds("curl -sSf http://localhost:3000/new")
53     with subtest("HedgeDoc postgres"):
54         hedgedocPostgres.wait_for_unit("postgresql.service")
55         hedgedocPostgres.wait_for_unit("hedgedoc.service")
56         hedgedocPostgres.wait_for_open_port(5432)
57         hedgedocPostgres.wait_for_open_port(3000)
58         hedgedocPostgres.wait_until_succeeds("curl -sSf http://localhost:3000/new")
59   '';