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 tcpPort = 10005; 6 httpPort = 10080; 7 tcpStreamPort = 10006; 8 in { 9 name = "snapcast"; 10 meta = with pkgs.lib.maintainers; { ··· 18 port = port; 19 tcp.port = tcpPort; 20 http.port = httpPort; 21 streams = { 22 mpd = { 23 type = "pipe"; ··· 35 }; 36 }; 37 }; 38 }; 39 40 testScript = '' ··· 61 server.succeed( 62 "curl --fail http://localhost:${toString httpPort}/jsonrpc -d '{json.dumps(get_rpc_version)}'" 63 ) 64 ''; 65 })
··· 5 tcpPort = 10005; 6 httpPort = 10080; 7 tcpStreamPort = 10006; 8 + bufferSize = 742; 9 in { 10 name = "snapcast"; 11 meta = with pkgs.lib.maintainers; { ··· 19 port = port; 20 tcp.port = tcpPort; 21 http.port = httpPort; 22 + buffer = bufferSize; 23 streams = { 24 mpd = { 25 type = "pipe"; ··· 37 }; 38 }; 39 }; 40 + client = { 41 + environment.systemPackages = [ pkgs.snapcast ]; 42 + }; 43 }; 44 45 testScript = '' ··· 66 server.succeed( 67 "curl --fail http://localhost:${toString httpPort}/jsonrpc -d '{json.dumps(get_rpc_version)}'" 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}") 76 ''; 77 })