1 { name, pkgs, testBase, system, ... }:
3 with import ../../lib/testing-python.nix { inherit system pkgs; };
4 runTest ({ config, ... }: {
6 meta = with pkgs.lib.maintainers; {
7 maintainers = [ eqyiel ma27 ];
10 imports = [ testBase ];
13 nextcloud = { config, pkgs, lib, ... }: {
14 services.nextcloud = {
20 config.dbtype = "pgsql";
25 extraAppsEnable = true;
26 extraApps = with config.services.nextcloud.package.packages.apps; {
27 inherit notify_push notes;
29 settings.trusted_proxies = [ "::1" ];
32 services.redis.servers."nextcloud".enable = true;
33 services.redis.servers."nextcloud".port = 6379;
37 test-helpers.init = let
38 configureRedis = pkgs.writeScript "configure-redis" ''
39 nextcloud-occ config:system:set redis 'host' --value 'localhost' --type string
40 nextcloud-occ config:system:set redis 'port' --value 6379 --type integer
41 nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string
42 nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
45 nextcloud.succeed("${configureRedis}")
48 test-helpers.extraTests = ''
49 with subtest("notify-push"):
50 client.execute("${pkgs.lib.getExe pkgs.nextcloud-notify_push.passthru.test_client} http://nextcloud ${config.adminuser} ${config.adminpass} >&2 &")
51 nextcloud.wait_until_succeeds("journalctl -u nextcloud-notify_push | grep -q \"Sending ping to ${config.adminuser}\"")
53 with subtest("Redis is used for caching"):
54 # redis cache should not be empty
55 nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
57 with subtest("No code is returned when requesting PHP files (regression test)"):
58 nextcloud.fail("curl -f http://nextcloud/nix-apps/notes/lib/AppInfo/Application.php")