nixos/tests/nextcloud: fix more issues related to redis tests

* Ensure that the redis cache is actually used in the "trivial" case
  (`with-postgresql-and-redis`)
* Test against all Nextcloud versions we've packaged
* Actually set a secret to make sure that the provided secret is
  properly read by Nextcloud.
* Add myself as maintainer to the secret-test to make sure that I don't
  miss any more changes like this that could break the functionality of
  that feature.
This commit is contained in:
Maximilian Bosch 2023-06-17 14:04:44 +02:00
parent 9fce0f6550
commit cac7282c17
No known key found for this signature in database
GPG key ID: 9A6EEA275CA5BE0A
2 changed files with 13 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import ../make-test-python.nix ({ pkgs, ...}: let args@{ nextcloudVersion ? 27, ... }:
(import ../make-test-python.nix ({ pkgs, ...}: let
username = "custom_admin_username"; username = "custom_admin_username";
# This will be used both for redis and postgresql # This will be used both for redis and postgresql
pass = "hunter2"; pass = "hunter2";
@ -9,7 +10,7 @@ import ../make-test-python.nix ({ pkgs, ...}: let
in { in {
name = "nextcloud-with-declarative-redis"; name = "nextcloud-with-declarative-redis";
meta = with pkgs.lib.maintainers; { meta = with pkgs.lib.maintainers; {
maintainers = [ eqyiel ]; maintainers = [ eqyiel ma27 ];
}; };
nodes = { nodes = {
@ -22,6 +23,7 @@ in {
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
hostName = "nextcloud"; hostName = "nextcloud";
package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
caching = { caching = {
apcu = false; apcu = false;
redis = true; redis = true;
@ -47,8 +49,11 @@ in {
configureRedis = true; configureRedis = true;
}; };
services.redis.servers."nextcloud".enable = true; services.redis.servers."nextcloud" = {
services.redis.servers."nextcloud".port = 6379; enable = true;
port = 6379;
requirePass = "secret";
};
systemd.services.nextcloud-setup= { systemd.services.nextcloud-setup= {
requires = ["postgresql.service"]; requires = ["postgresql.service"];
@ -114,4 +119,4 @@ in {
# redis cache should not be empty # redis cache should not be empty
nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"') nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
''; '';
}) })) args

View file

@ -89,5 +89,8 @@ in {
"${withRcloneEnv} ${diffSharedFile}" "${withRcloneEnv} ${diffSharedFile}"
) )
nextcloud.wait_until_succeeds("journalctl -u nextcloud-notify_push | grep -q \"Sending ping to ${adminuser}\"") nextcloud.wait_until_succeeds("journalctl -u nextcloud-notify_push | grep -q \"Sending ping to ${adminuser}\"")
# redis cache should not be empty
nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
''; '';
})) args })) args