summary refs log tree commit diff
path: root/nixos/tests/zammad.nix
diff options
context:
space:
mode:
authorTaeer Bar-Yam <taeer@bar-yam.me>2022-02-22 05:37:03 -0500
committerTaeer Bar-Yam <taeer@bar-yam.me>2022-02-23 10:41:28 -0500
commit74dcaf578442bfafba924e5494bef2dc830d0991 (patch)
treed9883f89e79181275ff8da5f168c792a1fcba713 /nixos/tests/zammad.nix
parent00e74ad907f9e9c57be90bf3983d2f7ea7442b56 (diff)
downloadnixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.tar
nixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.tar.gz
nixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.tar.bz2
nixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.tar.lz
nixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.tar.xz
nixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.tar.zst
nixpkgs-74dcaf578442bfafba924e5494bef2dc830d0991.zip
zammad: test passes!
Diffstat (limited to 'nixos/tests/zammad.nix')
-rw-r--r--nixos/tests/zammad.nix33
1 files changed, 32 insertions, 1 deletions
diff --git a/nixos/tests/zammad.nix b/nixos/tests/zammad.nix
index 4da50319562..4e466f6e3b9 100644
--- a/nixos/tests/zammad.nix
+++ b/nixos/tests/zammad.nix
@@ -6,11 +6,39 @@ import ./make-test-python.nix (
 
     meta.maintainers = with lib.maintainers; [ garbas taeer ];
 
-    nodes.machine = {
+    nodes.machine = { config, ... }: {
       services.zammad.enable = true;
       services.zammad.secretKeyBaseFile = pkgs.writeText "secret" ''
         52882ef142066e09ab99ce816ba72522e789505caba224a52d750ec7dc872c2c371b2fd19f16b25dfbdd435a4dd46cb3df9f82eb63fafad715056bdfe25740d6
       '';
+
+      systemd.services.zammad-locale-cheat =
+        let cfg = config.services.zammad; in
+        {
+          serviceConfig = {
+            Type = "simple";
+            Restart = "always";
+
+            User = "zammad";
+            Group = "zammad";
+            PrivateTmp = true;
+            StateDirectory = "zammad";
+            WorkingDirectory = cfg.dataDir;
+          };
+          wantedBy = [ "zammad-web.service" ];
+          description = "Hack in the locale files so zammad doesn't try to access the internet";
+          script = ''
+            mkdir -p ./config/translations
+            VERSION=$(cat ${cfg.package}/VERSION)
+
+            # If these files are not in place, zammad will try to access the internet.
+            # For the test, we only need to supply en-us.
+            echo '[{"locale":"en-us","alias":"en","name":"English (United States)","active":true,"dir":"ltr"}]' \
+              > ./config/locales-$VERSION.yml
+            echo '[{"locale":"en-us","format":"time","source":"date","target":"mm/dd/yyyy","target_initial":"mm/dd/yyyy"},{"locale":"en-us","format":"time","source":"timestamp","target":"mm/dd/yyyy HH:MM","target_initial":"mm/dd/yyyy HH:MM"}]' \
+              > ./config/translations/en-us-$VERSION.yml
+          '';
+        };
     };
 
     testScript = ''
@@ -19,6 +47,9 @@ import ./make-test-python.nix (
       machine.wait_for_unit("zammad-web.service")
       machine.wait_for_unit("zammad-websocket.service")
       machine.wait_for_unit("zammad-scheduler.service")
+      # wait for zammad to fully come up
+      machine.sleep(120)
+
       # without the grep the command does not produce valid utf-8 for some reason
       with subtest("welcome screen loads"):
           machine.succeed(