diff options
-rw-r--r-- | nixos/tests/nextcloud/with-objectstore.nix | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/nixos/tests/nextcloud/with-objectstore.nix b/nixos/tests/nextcloud/with-objectstore.nix index 6fec63b4aee22..1ca297c1c4d9e 100644 --- a/nixos/tests/nextcloud/with-objectstore.nix +++ b/nixos/tests/nextcloud/with-objectstore.nix @@ -4,8 +4,8 @@ args@{ pkgs, nextcloudVersion ? 28, ... }: adminpass = "hunter2"; adminuser = "root"; - accessKey = "nextcloud"; - secretKey = "test12345"; + accessKey = "BKIKJAA5BMMU2RHO6IBB"; + secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12"; rootCredentialsFile = pkgs.writeText "minio-credentials-full" '' MINIO_ROOT_USER=${accessKey} @@ -15,7 +15,7 @@ args@{ pkgs, nextcloudVersion ? 28, ... }: in { name = "nextcloud-with-objectstore"; meta = with pkgs.lib.maintainers; { - maintainers = [ onny ]; + maintainers = [ onny ma27 ]; }; nodes = { @@ -23,7 +23,8 @@ in { client = { ... }: {}; nextcloud = { config, pkgs, ... }: { - networking.firewall.allowedTCPPorts = [ 9000 ]; + networking.firewall.allowedTCPPorts = [ 80 9000 ]; + environment.systemPackages = [ pkgs.minio-client ]; services.nextcloud = { enable = true; @@ -35,8 +36,8 @@ in { config.objectstore.s3 = { enable = true; bucket = "nextcloud"; - autocreate = true; - key = "nextcloud"; + autocreate = false; + key = accessKey; secretFile = "${pkgs.writeText "secretKey" secretKey}"; hostname = "nextcloud"; useSsl = false; @@ -64,31 +65,39 @@ in { export RCLONE_CONFIG_NEXTCLOUD_VENDOR="nextcloud" export RCLONE_CONFIG_NEXTCLOUD_USER="${adminuser}" export RCLONE_CONFIG_NEXTCLOUD_PASS="$(${pkgs.rclone}/bin/rclone obscure ${adminpass})" + "''${@}" ''; copySharedFile = pkgs.writeScript "copy-shared-file" '' #!${pkgs.runtimeShell} + set -euxo pipefail echo 'hello world' | ${pkgs.rclone}/bin/rclone rcat nextcloud:test-shared-file ''; diffSharedFile = pkgs.writeScript "diff-shared-file" '' #!${pkgs.runtimeShell} - export AWS_ACCESS_KEY_ID=${accessKey} - export AWS_SECRET_ACCESS_KEY=${secretKey} - ${pkgs.awscli2}/bin/aws s3 cp s3://nextcloud /tmp/. --recursive --endpoint-url http://nextcloud:9000 --region us-east-1 - grep -r "hello world" /tmp + set -euxo pipefail + diff <(echo 'hello world') <(${pkgs.rclone}/bin/rclone cat nextcloud:test-shared-file) ''; in '' start_all() nextcloud.wait_for_unit("multi-user.target") nextcloud.wait_for_unit("minio.service") nextcloud.wait_for_open_port(9000) - nextcloud.succeed("curl -sSf http://nextcloud/login") nextcloud.succeed( - "${withRcloneEnv} ${copySharedFile}" + "mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} --api s3v4" ) + nextcloud.succeed("mc mb minio/nextcloud") + nextcloud.succeed("curl -sSf http://nextcloud/login") + client.wait_for_unit("multi-user.target") + client.succeed( + "${withRcloneEnv} ${copySharedFile}" + ) + nextcloud.succeed("${withRcloneEnv} ${diffSharedFile}") client.wait_until_succeeds( - "${diffSharedFile}" + "${withRcloneEnv} ${diffSharedFile}" ) + + nextcloud.succeed("mc ls --recursive minio >&2") ''; })) args |