Skip to content

Commit

Permalink
nixos/tests/nextcloud: fix more issues related to redis tests
Browse files Browse the repository at this point in the history
* 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.

(cherry picked from commit cac7282)
  • Loading branch information
Ma27 committed Jun 17, 2023
1 parent e1f2412 commit 72ac27e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 10 additions & 5 deletions nixos/tests/nextcloud/with-declarative-redis-and-secrets.nix
Original file line number Diff line number Diff line change
@@ -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";
# This will be used both for redis and postgresql
pass = "hunter2";
Expand All @@ -9,7 +10,7 @@ import ../make-test-python.nix ({ pkgs, ...}: let
in {
name = "nextcloud-with-declarative-redis";
meta = with pkgs.lib.maintainers; {
maintainers = [ eqyiel ];
maintainers = [ eqyiel ma27 ];
};

nodes = {
Expand All @@ -22,6 +23,7 @@ in {
services.nextcloud = {
enable = true;
hostName = "nextcloud";
package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
caching = {
apcu = false;
redis = true;
Expand All @@ -47,8 +49,11 @@ in {
configureRedis = true;
};

services.redis.servers."nextcloud".enable = true;
services.redis.servers."nextcloud".port = 6379;
services.redis.servers."nextcloud" = {
enable = true;
port = 6379;
requirePass = "secret";
};

systemd.services.nextcloud-setup= {
requires = ["postgresql.service"];
Expand Down Expand Up @@ -114,4 +119,4 @@ in {
# redis cache should not be empty
nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
'';
})
})) args
3 changes: 3 additions & 0 deletions nixos/tests/nextcloud/with-postgresql-and-redis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@ in {
"${withRcloneEnv} ${diffSharedFile}"
)
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

0 comments on commit 72ac27e

Please sign in to comment.