nixpkgs/nixos/tests/nextcloud/with-postgresql-and-redis.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

81 lines
2.3 KiB
Nix

{
name,
pkgs,
testBase,
system,
...
}:
with import ../../lib/testing-python.nix { inherit system pkgs; };
runTest (
{ config, ... }:
{
inherit name;
meta = with pkgs.lib.maintainers; {
maintainers = [
eqyiel
ma27
];
};
imports = [ testBase ];
nodes = {
nextcloud =
{
config,
pkgs,
lib,
...
}:
{
services.nextcloud = {
caching = {
apcu = false;
redis = true;
memcached = false;
};
config.dbtype = "pgsql";
notify_push = {
enable = true;
logLevel = "debug";
};
extraAppsEnable = true;
extraApps = with config.services.nextcloud.package.packages.apps; {
inherit notify_push notes;
};
settings.trusted_proxies = [ "::1" ];
};
services.redis.servers."nextcloud".enable = true;
services.redis.servers."nextcloud".port = 6379;
};
};
test-helpers.init =
let
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}")
'';
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}\"")
with subtest("Redis is used for caching"):
# redis cache should not be empty
nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
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")
'';
}
)