From 10703a8c926e182311cdf538937517db33f4261c Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 1 Oct 2021 17:03:32 +0200 Subject: [PATCH] nixos/nextcloud: run tests against each Nextcloud instance --- nixos/tests/nextcloud/basic.nix | 7 ++++-- nixos/tests/nextcloud/default.nix | 22 ++++++++++++++----- .../nextcloud/with-mysql-and-memcached.nix | 7 ++++-- .../nextcloud/with-postgresql-and-redis.nix | 7 ++++-- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix index c4ce34748ace..40ee9d5184cc 100644 --- a/nixos/tests/nextcloud/basic.nix +++ b/nixos/tests/nextcloud/basic.nix @@ -1,4 +1,6 @@ -import ../make-test-python.nix ({ pkgs, ...}: let +args@{ pkgs, nextcloudVersion ? 22, ... }: + +(import ../make-test-python.nix ({ pkgs, ...}: let adminpass = "notproduction"; adminuser = "root"; in { @@ -39,6 +41,7 @@ in { inherit adminpass; dbtableprefix = "nixos_"; }; + package = pkgs.${"nextcloud" + (toString nextcloudVersion)}; autoUpdateApps = { enable = true; startAt = "20:00"; @@ -100,4 +103,4 @@ in { ) assert "hi" in client.succeed("cat /mnt/dav/test-shared-file") ''; -}) +})) args diff --git a/nixos/tests/nextcloud/default.nix b/nixos/tests/nextcloud/default.nix index e4c7a70606cf..65043e509b3b 100644 --- a/nixos/tests/nextcloud/default.nix +++ b/nixos/tests/nextcloud/default.nix @@ -2,8 +2,20 @@ config ? {}, pkgs ? import ../../.. { inherit system config; } }: -{ - basic = import ./basic.nix { inherit system pkgs; }; - with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system pkgs; }; - with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system pkgs; }; -} + +with pkgs.lib; + +foldl + (matrix: ver: matrix // { + "basic${toString ver}" = import ./basic.nix { inherit system pkgs; nextcloudVersion = ver; }; + "with-postgresql-and-redis${toString ver}" = import ./with-postgresql-and-redis.nix { + inherit system pkgs; + nextcloudVersion = ver; + }; + "with-mysql-and-memcached${toString ver}" = import ./with-mysql-and-memcached.nix { + inherit system pkgs; + nextcloudVersion = ver; + }; + }) + {} + [ 20 21 22 ] diff --git a/nixos/tests/nextcloud/with-mysql-and-memcached.nix b/nixos/tests/nextcloud/with-mysql-and-memcached.nix index 82041874de43..639a3f4c8736 100644 --- a/nixos/tests/nextcloud/with-mysql-and-memcached.nix +++ b/nixos/tests/nextcloud/with-mysql-and-memcached.nix @@ -1,4 +1,6 @@ -import ../make-test-python.nix ({ pkgs, ...}: let +args@{ pkgs, nextcloudVersion ? 22, ... }: + +(import ../make-test-python.nix ({ pkgs, ...}: let adminpass = "hunter2"; adminuser = "root"; in { @@ -18,6 +20,7 @@ in { enable = true; hostName = "nextcloud"; https = true; + package = pkgs.${"nextcloud" + (toString nextcloudVersion)}; caching = { apcu = true; redis = false; @@ -96,4 +99,4 @@ in { "${withRcloneEnv} ${diffSharedFile}" ) ''; -}) +})) args diff --git a/nixos/tests/nextcloud/with-postgresql-and-redis.nix b/nixos/tests/nextcloud/with-postgresql-and-redis.nix index 81af620598ee..36a69fda505b 100644 --- a/nixos/tests/nextcloud/with-postgresql-and-redis.nix +++ b/nixos/tests/nextcloud/with-postgresql-and-redis.nix @@ -1,4 +1,6 @@ -import ../make-test-python.nix ({ pkgs, ...}: let +args@{ pkgs, nextcloudVersion ? 22, ... }: + +(import ../make-test-python.nix ({ pkgs, ...}: let adminpass = "hunter2"; adminuser = "custom-admin-username"; in { @@ -17,6 +19,7 @@ in { services.nextcloud = { enable = true; hostName = "nextcloud"; + package = pkgs.${"nextcloud" + (toString nextcloudVersion)}; caching = { apcu = false; redis = true; @@ -96,4 +99,4 @@ in { "${withRcloneEnv} ${diffSharedFile}" ) ''; -}) +})) args