2024-06-20 14:57:18 +00:00
|
|
|
{ name, pkgs, testBase, system, ... }:
|
2021-10-04 12:37:57 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
with import ../../lib/testing-python.nix { inherit system pkgs; };
|
|
|
|
runTest ({ config, ... }: {
|
|
|
|
inherit name;
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2024-06-20 14:57:18 +00:00
|
|
|
maintainers = [ eqyiel ma27 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
imports = [ testBase ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nodes = {
|
2023-03-04 12:14:45 +00:00
|
|
|
nextcloud = { config, pkgs, lib, ... }: {
|
2020-04-24 23:36:52 +00:00
|
|
|
services.nextcloud = {
|
|
|
|
caching = {
|
|
|
|
apcu = false;
|
|
|
|
redis = true;
|
|
|
|
memcached = false;
|
|
|
|
};
|
2024-06-20 14:57:18 +00:00
|
|
|
config.dbtype = "pgsql";
|
2023-03-04 12:14:45 +00:00
|
|
|
notify_push = {
|
|
|
|
enable = true;
|
|
|
|
logLevel = "debug";
|
|
|
|
};
|
|
|
|
extraAppsEnable = true;
|
2024-06-20 14:57:18 +00:00
|
|
|
extraApps = with config.services.nextcloud.package.packages.apps; {
|
|
|
|
inherit notify_push notes;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-02-07 01:22:34 +00:00
|
|
|
settings.trusted_proxies = [ "::1" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-11 15:47:08 +00:00
|
|
|
services.redis.servers."nextcloud".enable = true;
|
|
|
|
services.redis.servers."nextcloud".port = 6379;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
test-helpers.init = let
|
2020-04-24 23:36:52 +00:00
|
|
|
configureRedis = pkgs.writeScript "configure-redis" ''
|
|
|
|
nextcloud-occ config:system:set redis 'host' --value 'localhost' --type string
|
|
|
|
nextcloud-occ config:system:set redis 'port' --value 6379 --type integer
|
|
|
|
nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string
|
|
|
|
nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
|
|
|
|
'';
|
|
|
|
in ''
|
|
|
|
nextcloud.succeed("${configureRedis}")
|
2024-06-20 14:57:18 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
test-helpers.extraTests = ''
|
|
|
|
with subtest("notify-push"):
|
|
|
|
client.execute("${pkgs.lib.getExe pkgs.nextcloud-notify_push.passthru.test_client} http://nextcloud ${config.adminuser} ${config.adminpass} >&2 &")
|
|
|
|
nextcloud.wait_until_succeeds("journalctl -u nextcloud-notify_push | grep -q \"Sending ping to ${config.adminuser}\"")
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
with subtest("Redis is used for caching"):
|
|
|
|
# redis cache should not be empty
|
|
|
|
nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
with subtest("No code is returned when requesting PHP files (regression test)"):
|
|
|
|
nextcloud.fail("curl -f http://nextcloud/nix-apps/notes/lib/AppInfo/Application.php")
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2024-06-20 14:57:18 +00:00
|
|
|
})
|