about summary refs log tree commit diff
path: root/nixos/tests/snapcast.nix
diff options
context:
space:
mode:
authorJan Beinke <git@janbeinke.com>2021-02-07 23:22:06 +0100
committerJan Beinke <git@janbeinke.com>2021-02-07 23:43:59 +0100
commitc4b5a703ab6e280332e86f1fa09774af3d1a1592 (patch)
treedb3d3d651b9ffa6f8739eece39e1a79a4adc8c48 /nixos/tests/snapcast.nix
parent9de9838986488f3deabcb277f815f29e656f24aa (diff)
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.
Diffstat (limited to 'nixos/tests/snapcast.nix')
-rw-r--r--nixos/tests/snapcast.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/tests/snapcast.nix b/nixos/tests/snapcast.nix
index 05d08d76cc055..2fef636251401 100644
--- a/nixos/tests/snapcast.nix
+++ b/nixos/tests/snapcast.nix
@@ -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}")
   '';
 })