nixos/tests/botamusique: migrate to runTest

Part of #386873
This commit is contained in:
Martin Weinelt 2025-03-10 20:15:36 +01:00
parent 2f12626091
commit c249dcf2f3
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
2 changed files with 46 additions and 44 deletions

View file

@ -212,7 +212,7 @@ in {
boot-stage2 = handleTest ./boot-stage2.nix {}; boot-stage2 = handleTest ./boot-stage2.nix {};
borgbackup = handleTest ./borgbackup.nix {}; borgbackup = handleTest ./borgbackup.nix {};
borgmatic = handleTest ./borgmatic.nix {}; borgmatic = handleTest ./borgmatic.nix {};
botamusique = handleTest ./botamusique.nix {}; botamusique = runTest ./botamusique.nix;
bpf = handleTestOn ["x86_64-linux" "aarch64-linux"] ./bpf.nix {}; bpf = handleTestOn ["x86_64-linux" "aarch64-linux"] ./bpf.nix {};
bpftune = handleTest ./bpftune.nix {}; bpftune = handleTest ./bpftune.nix {};
breitbandmessung = handleTest ./breitbandmessung.nix {}; breitbandmessung = handleTest ./breitbandmessung.nix {};

View file

@ -1,55 +1,57 @@
import ./make-test-python.nix ( {
{ pkgs, lib, ... }: pkgs,
lib,
...
}:
{ {
name = "botamusique"; name = "botamusique";
meta.maintainers = with lib.maintainers; [ hexa ]; meta.maintainers = with lib.maintainers; [ hexa ];
nodes = { nodes = {
machine = machine =
{ config, ... }: { config, ... }:
{ {
networking.extraHosts = '' networking.extraHosts = ''
127.0.0.1 all.api.radio-browser.info 127.0.0.1 all.api.radio-browser.info
''; '';
services.murmur = { services.murmur = {
enable = true; enable = true;
registerName = "NixOS tests"; registerName = "NixOS tests";
}; };
services.botamusique = { services.botamusique = {
enable = true; enable = true;
settings = { settings = {
server = { server = {
channel = "NixOS tests"; channel = "NixOS tests";
}; };
bot = { bot = {
version = false; version = false;
auto_check_update = false; auto_check_update = false;
};
}; };
}; };
}; };
}; };
};
testScript = '' testScript = ''
start_all() start_all()
machine.wait_for_unit("murmur.service") machine.wait_for_unit("murmur.service")
machine.wait_for_unit("botamusique.service") machine.wait_for_unit("botamusique.service")
machine.sleep(10) machine.sleep(10)
machine.wait_until_succeeds( machine.wait_until_succeeds(
"journalctl -u murmur.service -e | grep -q '<1:botamusique(-1)> Authenticated'" "journalctl -u murmur.service -e | grep -q '<1:botamusique(-1)> Authenticated'"
) )
with subtest("Check systemd hardening"): with subtest("Check systemd hardening"):
output = machine.execute("systemctl show botamusique.service")[1] output = machine.execute("systemctl show botamusique.service")[1]
machine.log(output) machine.log(output)
output = machine.execute("systemd-analyze security botamusique.service")[1] output = machine.execute("systemd-analyze security botamusique.service")[1]
machine.log(output) machine.log(output)
''; '';
} }
)