zammad: test passes!

main
Taeer Bar-Yam 2 years ago
parent 00e74ad907
commit 74dcaf5784
  1. 5
      nixos/modules/services/development/zammad.nix
  2. 33
      nixos/tests/zammad.nix
  3. 4
      pkgs/applications/networking/misc/zammad/default.nix

@ -234,8 +234,7 @@ in
inherit environment;
serviceConfig = serviceConfig // {
# loading all the gems takes time
TimeoutStartSec = 600;
Restart = "no";
TimeoutStartSec = 1200;
};
after = [
"network.target"
@ -270,6 +269,7 @@ in
cat ${cfg.secretKeyBaseFile}
} > ./config/secrets.yml
''}
if [ `${config.services.postgresql.package}/bin/psql \
--host ${cfg.database.host} \
${optionalString
@ -307,6 +307,7 @@ in
serviceConfig = serviceConfig // { Type = "forking"; };
after = [ "zammad-web.service" ];
requires = [ "zammad-web.service" ];
wants = [ "zammad-web.service" ];
description = "Zammad scheduler";
wantedBy = [ "multi-user.target" ];
script = "./script/scheduler.rb start";

@ -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(

@ -116,9 +116,7 @@ stdenv.mkDerivation {
'';
installPhase = ''
mkdir -p $out/config
cp -R ./* $out
rm -R $out/tmp/*
cp -R . $out
cp ${databaseConfig} $out/config/database.yml
cp ${secretsConfig} $out/config/secrets.yml
sed -i -e "s|info|debug|" $out/config/environments/production.rb

Loading…
Cancel
Save