about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/web-apps/writefreely.nix
blob: ce614909706b40e8ee13f2ba15ae355d82374f87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ system ? builtins.currentSystem, config ? { }
, pkgs ? import ../../.. { inherit system config; } }:

with import ../../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;

let
  writefreelyTest = { name, type }:
    makeTest {
      name = "writefreely-${name}";

      nodes.machine = { config, pkgs, ... }: {
        services.writefreely = {
          enable = true;
          host = "localhost:3000";
          admin.name = "nixos";

          database = {
            inherit type;
            createLocally = type == "mysql";
            passwordFile = pkgs.writeText "db-pass" "pass";
          };

          settings.server.port = 3000;
        };
      };

      testScript = ''
        start_all()
        machine.wait_for_unit("writefreely.service")
        machine.wait_for_open_port(3000)
        machine.succeed("curl --fail http://localhost:3000")
      '';
    };
in {
  sqlite = writefreelyTest {
    name = "sqlite";
    type = "sqlite3";
  };
  mysql = writefreelyTest {
    name = "mysql";
    type = "mysql";
  };
}