1import ./make-test-python.nix (
2 { lib, pkgs, ... }:
3 {
4 name = "szurubooru";
5 meta.maintainers = with lib.maintainers; [ ratcornu ];
6
7 nodes.machine =
8 let
9 dbpass = "changeme";
10 in
11
12 { config, ... }:
13 {
14 services.postgresql = {
15 enable = true;
16 initialScript = pkgs.writeText "init.sql" ''
17 CREATE USER ${config.services.szurubooru.database.user} WITH PASSWORD '${dbpass}';
18 CREATE DATABASE ${config.services.szurubooru.database.name} WITH OWNER ${config.services.szurubooru.database.user};
19 '';
20 };
21
22 services.szurubooru = {
23 enable = true;
24
25 dataDir = "/var/lib/szurubooru";
26
27 server = {
28 port = 6666;
29 settings = {
30 domain = "http://127.0.0.1";
31 secretFile = pkgs.writeText "secret" "secret";
32 debug = 1;
33 };
34 };
35
36 database = {
37 host = "localhost";
38 port = 5432;
39 name = "szurubooru";
40 user = "szurubooru";
41 passwordFile = pkgs.writeText "pass" "${dbpass}";
42 };
43 };
44 };
45
46 testScript = ''
47 machine.wait_for_unit("szurubooru.service")
48 machine.wait_for_open_port(6666)
49 machine.succeed('curl -H "Content-Type: application/json" -H "Accept: application/json" --fail http://127.0.0.1:6666/info')
50 '';
51 }
52)