Merge pull request #112344 from thelegy/tests-snapcast

tests/snapserver: Add test of connection and buffer size setting
This commit is contained in:
Martin Weinelt 2021-02-08 00:58:01 +01:00 committed by GitHub
commit e1fb00e77e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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}")
'';
})