From 6f5d41250171eea5863dedfde080939e9a31d4cc Mon Sep 17 00:00:00 2001 From: jiezhuzzz Date: Tue, 5 May 2026 21:59:44 -0500 Subject: [PATCH] rclone tests: add Darwin serve sidecar test --- tests/modules/programs/rclone/default.nix | 1 + .../serve-service-generation-darwin.nix | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/modules/programs/rclone/serve-service-generation-darwin.nix diff --git a/tests/modules/programs/rclone/default.nix b/tests/modules/programs/rclone/default.nix index 759a6b6cd..b068e98c6 100644 --- a/tests/modules/programs/rclone/default.nix +++ b/tests/modules/programs/rclone/default.nix @@ -8,4 +8,5 @@ } // lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin { rclone-mount-service-generation-darwin = ./mount-service-generation-darwin.nix; + rclone-serve-service-generation-darwin = ./serve-service-generation-darwin.nix; } diff --git a/tests/modules/programs/rclone/serve-service-generation-darwin.nix b/tests/modules/programs/rclone/serve-service-generation-darwin.nix new file mode 100644 index 000000000..c56424647 --- /dev/null +++ b/tests/modules/programs/rclone/serve-service-generation-darwin.nix @@ -0,0 +1,59 @@ +_: { + programs.rclone = { + enable = true; + remotes = { + sftp-remote = { + config = { + type = "sftp"; + host = "backup-server.example.com"; + user = "alice"; + key_file = "/Users/alice/.ssh/id_ed25519"; + }; + serve = { + "documents/work" = { + enable = true; + protocol = "http"; + logLevel = "ERROR"; + options = { + addr = "127.0.0.1:8080"; + dir-cache-time = "5000h"; + }; + }; + "/games" = { + enable = true; + protocol = "ftp"; + }; + "disabled-serve" = { + enable = false; + protocol = "ftp"; + }; + }; + }; + }; + }; + + nmt.script = '' + # http serve + plist="LaunchAgents/org.nix-community.home.rclone-serve:documents.work@sftp-remote.plist" + assertFileExists "$plist" + assertFileContains "$plist" "rclone-sidecar-wrapper" + assertFileContains "$plist" "/bin/rclone" + assertFileContains "$plist" "serve" + assertFileContains "$plist" "http" + assertFileContains "$plist" "'--addr=127.0.0.1:8080'" + assertFileContains "$plist" "'--cache-dir=/home/hm-user/.cache/rclone'" + assertFileContains "$plist" "'--dir-cache-time=5000h'" + assertFileContains "$plist" "sftp-remote:documents/work" + assertFileContains "$plist" "RCLONE_LOG_LEVEL" + assertFileContains "$plist" "ERROR" + + # ftp serve + plist2="LaunchAgents/org.nix-community.home.rclone-serve:.games@sftp-remote.plist" + assertFileExists "$plist2" + assertFileContains "$plist2" "ftp" + assertFileContains "$plist2" "sftp-remote:/games" + + # Disabled serve produces no plist + assertPathNotExists "LaunchAgents/org.nix-community.home.rclone-serve:disabled-serve@sftp-remote.plist" + ''; +}