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

This addition will cover part of the issue, that was fixed in #112295
and @mweinelt asked to improve the tests.
This commit is contained in:
Jan Beinke 2021-02-07 23:22:06 +01:00
parent 9de9838986
commit c4b5a703ab
No known key found for this signature in database
GPG key ID: ED675B2FE3FEA71D

View file

@ -5,6 +5,7 @@ let
tcpPort = 10005;
httpPort = 10080;
tcpStreamPort = 10006;
bufferSize = 742;
in {
name = "snapcast";
meta = with pkgs.lib.maintainers; {
@ -18,6 +19,7 @@ in {
port = port;
tcp.port = tcpPort;
http.port = httpPort;
buffer = bufferSize;
streams = {
mpd = {
type = "pipe";
@ -35,6 +37,9 @@ in {
};
};
};
client = {
environment.systemPackages = [ pkgs.snapcast ];
};
};
testScript = ''
@ -61,5 +66,12 @@ in {
server.succeed(
"curl --fail http://localhost:${toString httpPort}/jsonrpc -d '{json.dumps(get_rpc_version)}'"
)
with subtest("test a connection"):
client.execute("systemd-run snapclient -h server -p ${toString port}")
server.wait_until_succeeds(
"journalctl -o cat -u snapserver.service | grep -q 'Hello from'"
)
client.wait_until_succeeds("journalctl -o cat -u run-\* | grep -q ${toString bufferSize}")
'';
})