Merge pull request #112344 from thelegy/tests-snapcast

tests/snapserver: Add test of connection and buffer size setting

authored by Martin Weinelt and committed by GitHub e1fb00e7 e69d305a

+12
+12
nixos/tests/snapcast.nix
··· 5 5 tcpPort = 10005; 6 6 httpPort = 10080; 7 7 tcpStreamPort = 10006; 8 + bufferSize = 742; 8 9 in { 9 10 name = "snapcast"; 10 11 meta = with pkgs.lib.maintainers; { ··· 18 19 port = port; 19 20 tcp.port = tcpPort; 20 21 http.port = httpPort; 22 + buffer = bufferSize; 21 23 streams = { 22 24 mpd = { 23 25 type = "pipe"; ··· 35 37 }; 36 38 }; 37 39 }; 40 + client = { 41 + environment.systemPackages = [ pkgs.snapcast ]; 42 + }; 38 43 }; 39 44 40 45 testScript = '' ··· 61 66 server.succeed( 62 67 "curl --fail http://localhost:${toString httpPort}/jsonrpc -d '{json.dumps(get_rpc_version)}'" 63 68 ) 69 + 70 + with subtest("test a connection"): 71 + client.execute("systemd-run snapclient -h server -p ${toString port}") 72 + server.wait_until_succeeds( 73 + "journalctl -o cat -u snapserver.service | grep -q 'Hello from'" 74 + ) 75 + client.wait_until_succeeds("journalctl -o cat -u run-\* | grep -q ${toString bufferSize}") 64 76 ''; 65 77 })