summary refs log tree commit diff
path: root/nixos/tests/botamusique.nix
blob: ccb105dc142f2a5501ea3e06c5a810d847f94849 (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
45
46
47
import ./make-test-python.nix ({ pkgs, lib, ...} :

{
  name = "botamusique";
  meta.maintainers = with lib.maintainers; [ hexa ];

  nodes = {
    machine = { config, ... }: {
      services.murmur = {
        enable = true;
        registerName = "NixOS tests";
      };

      services.botamusique = {
        enable = true;
        settings = {
          server = {
            channel = "NixOS tests";
          };
          bot = {
            version = false;
            auto_check_update = false;
          };
        };
      };
    };
  };

  testScript = ''
    start_all()

    machine.wait_for_unit("murmur.service")
    machine.wait_for_unit("botamusique.service")

    machine.sleep(10)

    machine.wait_until_succeeds(
        "journalctl -u murmur.service -e | grep -q '<1:botamusique(-1)> Authenticated'"
    )

    with subtest("Check systemd hardening"):
        output = machine.execute("systemctl show botamusique.service")[1]
        machine.log(output)
        output = machine.execute("systemd-analyze security botamusique.service")[1]
        machine.log(output)
  '';
})