summaryrefslogtreecommitdiffstats
path: root/nixos/tests/web-apps/rsshub.nix
blob: 89557aa2ab0145768e76bbd6ed6bb88cbc077490 (plain)
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
45
46
{ lib, ... }:
{
  name = "rsshub";

  meta.maintainers = with lib.maintainers; [ vonfry ];

  nodes = {
    basic = {
      services.rsshub.enable = true;
    };

    redis = {
      services.rsshub = {
        enable = true;

        redis = {
          enable = true;
          createLocally = true;
        };
      };
    };
  };

  testScript =
    { nodes, ... }:
    let
      port = nodes.basic.services.rsshub.settings.PORT;
    in
    ''
      def assert_http_200(machine, url):
        code = machine.succeed(f"curl -s -o /dev/null -w '%{{http_code}}' {url}").strip()
        assert code == "200", f"Expected HTTP 200 from {url}, got {code}"

      def test_node(node):
        node.wait_for_unit("rsshub.service")
        node.wait_for_open_port(${port})
        assert_http_200(node, "http://localhost:${port}/healthz")

      with subtest("RSSHub works"):
        test_node(basic)

      with subtest("RSSHub works with local Redis"):
        test_node(redis)

    '';
}