diff options
author | Rok Garbas <rok@garbas.si> | 2022-02-28 00:57:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 00:57:11 +0100 |
commit | 993c35991bf2203c34a9c90add6aeda232ccfad0 (patch) | |
tree | 2b4630ccf7263f16da39a1706d75fb88506d12d3 /nixos/tests | |
parent | cfe7ba29c548eb8ca4ade36ac6fe807184023d08 (diff) | |
parent | 13e35662ccfc4b516dca5e2802cb57ec6a08c57a (diff) | |
download | nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.tar nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.tar.gz nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.tar.bz2 nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.tar.lz nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.tar.xz nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.tar.zst nixlib-993c35991bf2203c34a9c90add6aeda232ccfad0.zip |
Merge pull request #157693 from Radvendii/zammad
zammad: init at 5.0.2
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/zammad.nix | 60 |
2 files changed, 61 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index da94fc6d042d..5d03893a56bd 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -572,6 +572,7 @@ in xxh = handleTest ./xxh.nix {}; yabar = handleTest ./yabar.nix {}; yggdrasil = handleTest ./yggdrasil.nix {}; + zammad = handleTest ./zammad.nix {}; zfs = handleTest ./zfs.nix {}; zigbee2mqtt = handleTest ./zigbee2mqtt.nix {}; zoneminder = handleTest ./zoneminder.nix {}; diff --git a/nixos/tests/zammad.nix b/nixos/tests/zammad.nix new file mode 100644 index 000000000000..4e466f6e3b9b --- /dev/null +++ b/nixos/tests/zammad.nix @@ -0,0 +1,60 @@ +import ./make-test-python.nix ( + { lib, pkgs, ... }: + + { + name = "zammad"; + + meta.maintainers = with lib.maintainers; [ garbas taeer ]; + + 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 = '' + start_all() + machine.wait_for_unit("postgresql.service") + 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( + "curl -sSfL http://localhost:3000/ | grep '<title>Zammad Helpdesk</title>'" + ) + ''; + } +) |