From cac7282c17494c669d7e42cdad70da428e1f045a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 17 Jun 2023 14:04:44 +0200 Subject: [PATCH] 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. --- .../with-declarative-redis-and-secrets.nix | 15 ++++++++++----- .../tests/nextcloud/with-postgresql-and-redis.nix | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/nixos/tests/nextcloud/with-declarative-redis-and-secrets.nix b/nixos/tests/nextcloud/with-declarative-redis-and-secrets.nix index 80151947800..915fa58ab14 100644 --- a/nixos/tests/nextcloud/with-declarative-redis-and-secrets.nix +++ b/nixos/tests/nextcloud/with-declarative-redis-and-secrets.nix @@ -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"; @@ -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 = { @@ -22,6 +23,7 @@ in { services.nextcloud = { enable = true; hostName = "nextcloud"; + package = pkgs.${"nextcloud" + (toString nextcloudVersion)}; caching = { apcu = false; redis = true; @@ -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"]; @@ -114,4 +119,4 @@ in { # redis cache should not be empty nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"') ''; -}) +})) args diff --git a/nixos/tests/nextcloud/with-postgresql-and-redis.nix b/nixos/tests/nextcloud/with-postgresql-and-redis.nix index 1cbb1310428..a91208e6cdc 100644 --- a/nixos/tests/nextcloud/with-postgresql-and-redis.nix +++ b/nixos/tests/nextcloud/with-postgresql-and-redis.nix @@ -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