about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorSophie Tauchert <sophie.tauchert@relaxdays.de>2023-07-07 11:27:55 +0200
committerSophie Tauchert <sophie@999eagle.moe>2023-09-18 08:24:36 +0200
commitb20cbb12cdcb1fb81a22f58f028a2d876eafa832 (patch)
tree00a7729deb442a41b11a93c6d47f562ae72a2883 /nixos/tests
parent3a6a07ecf1b38dd887f7af4bec3da6fe3c8eb227 (diff)
downloadnixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.tar
nixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.tar.gz
nixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.tar.bz2
nixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.tar.lz
nixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.tar.xz
nixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.tar.zst
nixlib-b20cbb12cdcb1fb81a22f58f028a2d876eafa832.zip
nixos/synapse: add test for running synapse with workers
Co-authored-by: Daniel Olsen <daniel.olsen99@gmail.com>
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/matrix/synapse-workers.nix55
2 files changed, 56 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 2d9674e69b64..0574c1db8754 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -468,6 +468,7 @@ in {
   matrix-appservice-irc = handleTest ./matrix/appservice-irc.nix {};
   matrix-conduit = handleTest ./matrix/conduit.nix {};
   matrix-synapse = handleTest ./matrix/synapse.nix {};
+  matrix-synapse-workers = handleTest ./matrix/synapse-workers.nix {};
   mattermost = handleTest ./mattermost.nix {};
   mediamtx = handleTest ./mediamtx.nix {};
   mediatomb = handleTest ./mediatomb.nix {};
diff --git a/nixos/tests/matrix/synapse-workers.nix b/nixos/tests/matrix/synapse-workers.nix
new file mode 100644
index 000000000000..a08b326abe62
--- /dev/null
+++ b/nixos/tests/matrix/synapse-workers.nix
@@ -0,0 +1,55 @@
+import ../make-test-python.nix ({ pkgs, ... }: {
+  name = "matrix-synapse-workers";
+  meta = with pkgs.lib; {
+    maintainers = teams.matrix.members;
+  };
+
+  nodes = {
+    homeserver =
+      { pkgs
+      , nodes
+      , ...
+      }: {
+        services.postgresql = {
+          enable = true;
+          initialScript = pkgs.writeText "synapse-init.sql" ''
+            CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
+            CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
+            TEMPLATE template0
+            LC_COLLATE = "C"
+            LC_CTYPE = "C";
+          '';
+        };
+
+        services.matrix-synapse = {
+          enable = true;
+          settings = {
+            database = {
+              name = "psycopg2";
+              args.password = "synapse";
+            };
+            enable_registration = true;
+            enable_registration_without_verification = true;
+
+            federation_sender_instances = [ "federation_sender" ];
+          };
+          configureRedisLocally = true;
+          workers = {
+            enable = true;
+            config = {
+              "federation_sender" = {
+                worker_app = "synapse.app.generic_worker";
+              };
+            };
+          };
+        };
+      };
+  };
+
+  testScript = ''
+    start_all()
+
+    homeserver.wait_for_unit("matrix-synapse.service");
+    homeserver.wait_for_unit("matrix-synapse-worker-federation_sender.service");
+  '';
+})