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