notes: 2.3.0 -> 2.3.1 (#352950)
[NixPkgs.git] / nixos / tests / zammad.nix
blobaaf32c6f13fe4f9fda9fe08d611b736eb2fadae9
1 import ./make-test-python.nix (
2   { lib, pkgs, ... }:
4   {
5     name = "zammad";
7     meta.maintainers = with lib.maintainers; [ taeer n0emis netali ];
9     nodes.machine = { config, ... }: {
10       virtualisation = {
11         memorySize = 2048;
12       };
14       services.zammad.enable = true;
15       services.zammad.secretKeyBaseFile = pkgs.writeText "secret" ''
16         52882ef142066e09ab99ce816ba72522e789505caba224a52d750ec7dc872c2c371b2fd19f16b25dfbdd435a4dd46cb3df9f82eb63fafad715056bdfe25740d6
17       '';
19       systemd.services.zammad-locale-cheat =
20         let cfg = config.services.zammad; in
21         {
22           serviceConfig = {
23             Type = "oneshot";
24             Restart = "on-failure";
26             User = "zammad";
27             Group = "zammad";
28             PrivateTmp = true;
29             StateDirectory = "zammad";
30             WorkingDirectory = cfg.dataDir;
31           };
32           wantedBy = [ "zammad-web.service" ];
33           description = "Hack in the locale files so zammad doesn't try to access the internet";
34           script = ''
35             mkdir -p ./config/translations
36             VERSION=$(cat ${cfg.package}/VERSION)
38             # If these files are not in place, zammad will try to access the internet.
39             # For the test, we only need to supply en-us.
40             echo '[{"locale":"en-us","alias":"en","name":"English (United States)","active":true,"dir":"ltr"}]' \
41               > ./config/locales-$VERSION.yml
42             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"}]' \
43               > ./config/translations/en-us-$VERSION.yml
44           '';
45         };
46     };
48     testScript = ''
49       start_all()
50       machine.wait_for_unit("postgresql.service")
51       machine.wait_for_unit("redis-zammad.service")
52       machine.wait_for_unit("zammad-web.service")
53       machine.wait_for_unit("zammad-websocket.service")
54       machine.wait_for_unit("zammad-worker.service")
55       # wait for zammad to fully come up
56       machine.sleep(120)
58       # without the grep the command does not produce valid utf-8 for some reason
59       with subtest("welcome screen loads"):
60           machine.succeed(
61               "curl -sSfL http://localhost:3000/ | grep '<title>Zammad Helpdesk</title>'"
62           )
63     '';
64   }