diff options
author | stuebinm <stuebinm@in.tum.de> | 2022-04-24 18:43:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-24 18:43:28 +0200 |
commit | 92fe62e1de5b587ee05d81400d8701558065f814 (patch) | |
tree | 2f978329eab91f04aa857a835baed4e412d7c4e4 /nixos/tests/nextcloud | |
parent | 1c9c4a8e807703e0414c01a1a05b45cef974e177 (diff) | |
parent | a3c605936a1d4ac47c61c875cf63b3d9e0b4415d (diff) |
Merge branch 'master' into nextcloud-secrets
Diffstat (limited to 'nixos/tests/nextcloud')
-rw-r--r-- | nixos/tests/nextcloud/basic.nix | 18 | ||||
-rw-r--r-- | nixos/tests/nextcloud/default.nix | 38 | ||||
-rw-r--r-- | nixos/tests/nextcloud/with-mysql-and-memcached.nix | 26 | ||||
-rw-r--r-- | nixos/tests/nextcloud/with-postgresql-and-redis.nix | 7 |
4 files changed, 55 insertions, 34 deletions
diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix index 5074b6cdafefe..eb37470a4c7bb 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 { @@ -31,13 +33,20 @@ in { in { networking.firewall.allowedTCPPorts = [ 80 ]; + systemd.tmpfiles.rules = [ + "d /var/lib/nextcloud-data 0750 nextcloud nginx - -" + ]; + services.nextcloud = { enable = true; + datadir = "/var/lib/nextcloud-data"; hostName = "nextcloud"; config = { # Don't inherit adminuser since "root" is supposed to be the default - inherit adminpass; + adminpassFile = "${pkgs.writeText "adminpass" adminpass}"; # Don't try this at home! + dbtableprefix = "nixos_"; }; + package = pkgs.${"nextcloud" + (toString nextcloudVersion)}; autoUpdateApps = { enable = true; startAt = "20:00"; @@ -51,7 +60,7 @@ in { nextcloudWithoutMagick = args@{ config, pkgs, lib, ... }: lib.mkMerge [ (nextcloud args) - { services.nextcloud.disableImagemagick = true; } ]; + { services.nextcloud.enableImagemagick = false; } ]; }; testScript = { nodes, ... }: let @@ -94,9 +103,10 @@ in { "${withRcloneEnv} ${copySharedFile}" ) client.wait_for_unit("multi-user.target") + nextcloud.succeed("test -f /var/lib/nextcloud-data/data/root/files/test-shared-file") client.succeed( "${withRcloneEnv} ${diffSharedFile}" ) 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 0e3f693674c2d..5d4663b5d85b1 100644 --- a/nixos/tests/nextcloud/default.nix +++ b/nixos/tests/nextcloud/default.nix @@ -1,11 +1,29 @@ -{ system ? builtins.currentSystem, - config ? {}, - pkgs ? import ../../.. { inherit system config; } +{ system ? builtins.currentSystem +, 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-declarative-redis = import ./with-declarative-redis.nix {inherit system pkgs; }; - with-secrets = import ./with-secrets.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; + }; + "with-declarative-redis${toString ver}" = import ./with-declarative-redis.nix { + inherit system pkgs; + nextcloudVersion = ver; + }; + "with-secrets${toString ver}" = import ./with-secrets.nix { + inherit system pkgs; + nextcloudVersion = ver; + }; + }) +{ } + [ 22 23 ] diff --git a/nixos/tests/nextcloud/with-mysql-and-memcached.nix b/nixos/tests/nextcloud/with-mysql-and-memcached.nix index 82041874de43f..63e0e2c59639e 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,37 +20,25 @@ in { enable = true; hostName = "nextcloud"; https = true; + package = pkgs.${"nextcloud" + (toString nextcloudVersion)}; caching = { apcu = true; redis = false; memcached = true; }; + database.createLocally = true; config = { dbtype = "mysql"; dbname = "nextcloud"; dbuser = "nextcloud"; dbhost = "127.0.0.1"; dbport = 3306; - dbpass = "hunter2"; + dbpassFile = "${pkgs.writeText "dbpass" "hunter2" }"; # Don't inherit adminuser since "root" is supposed to be the default - inherit adminpass; + adminpassFile = "${pkgs.writeText "adminpass" adminpass}"; # Don't try this at home! }; }; - services.mysql = { - enable = true; - bind = "127.0.0.1"; - package = pkgs.mariadb; - initialScript = pkgs.writeText "mysql-init" '' - CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'hunter2'; - CREATE DATABASE IF NOT EXISTS nextcloud; - GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, - CREATE TEMPORARY TABLES ON nextcloud.* TO 'nextcloud'@'localhost' - IDENTIFIED BY 'hunter2'; - FLUSH privileges; - ''; - }; - systemd.services.nextcloud-setup= { requires = ["mysql.service"]; after = ["mysql.service"]; @@ -96,4 +86,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 81af620598ee8..36a69fda505ba 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 |