1import ./make-test-python.nix ({ pkgs, lib, ... }:
2
3let
4 port = 3142;
5 username = "alice";
6 password = "correcthorsebatterystaple";
7 defaultPort = 8080;
8 defaultUsername = "admin";
9 defaultPassword = "password";
10in
11with lib;
12{
13 name = "miniflux";
14 meta.maintainers = with pkgs.lib.maintainers; [ ];
15
16 nodes = {
17 default =
18 { ... }:
19 {
20 services.miniflux.enable = true;
21 };
22
23 withoutSudo =
24 { ... }:
25 {
26 services.miniflux.enable = true;
27 security.sudo.enable = false;
28 };
29
30 customized =
31 { ... }:
32 {
33 services.miniflux = {
34 enable = true;
35 config = {
36 CLEANUP_FREQUENCY = "48";
37 LISTEN_ADDR = "localhost:${toString port}";
38 };
39 adminCredentialsFile = pkgs.writeText "admin-credentials" ''
40 ADMIN_USERNAME=${username}
41 ADMIN_PASSWORD=${password}
42 '';
43 };
44 };
45 };
46 testScript = ''
47 start_all()
48
49 default.wait_for_unit("miniflux.service")
50 default.wait_for_open_port(${toString defaultPort})
51 default.succeed("curl --fail 'http://localhost:${toString defaultPort}/healthcheck' | grep OK")
52 default.succeed(
53 "curl 'http://localhost:${toString defaultPort}/v1/me' -u '${defaultUsername}:${defaultPassword}' -H Content-Type:application/json | grep '\"is_admin\":true'"
54 )
55
56 withoutSudo.wait_for_unit("miniflux.service")
57 withoutSudo.wait_for_open_port(${toString defaultPort})
58 withoutSudo.succeed("curl --fail 'http://localhost:${toString defaultPort}/healthcheck' | grep OK")
59 withoutSudo.succeed(
60 "curl 'http://localhost:${toString defaultPort}/v1/me' -u '${defaultUsername}:${defaultPassword}' -H Content-Type:application/json | grep '\"is_admin\":true'"
61 )
62
63 customized.wait_for_unit("miniflux.service")
64 customized.wait_for_open_port(${toString port})
65 customized.succeed("curl --fail 'http://localhost:${toString port}/healthcheck' | grep OK")
66 customized.succeed(
67 "curl 'http://localhost:${toString port}/v1/me' -u '${username}:${password}' -H Content-Type:application/json | grep '\"is_admin\":true'"
68 )
69 '';
70})