From 960c009ce04305ebd52fb2b3c10122ded3146c4e Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 5 Sep 2022 13:51:03 +0200 Subject: [PATCH] git-sync: minor test cleanup --- tests/modules/services/git-sync/basic.nix | 78 +++++++++++------------ 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/tests/modules/services/git-sync/basic.nix b/tests/modules/services/git-sync/basic.nix index ff0cb78b7..039044bfe 100644 --- a/tests/modules/services/git-sync/basic.nix +++ b/tests/modules/services/git-sync/basic.nix @@ -1,45 +1,43 @@ -{ config, pkgs, ... }: +{ config, ... }: { - config = { - services.git-sync = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; }; - repositories.test = { - path = "/a/path"; - uri = "git+ssh://user@example.com:/~user/path/to/repo.git"; - }; + services.git-sync = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; }; + repositories.test = { + path = "/a/path"; + uri = "git+ssh://user@example.com:/~user/path/to/repo.git"; }; - - test.stubs = { - git = { name = "git"; }; - openssh = { name = "openssh"; }; - }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/git-sync-test.service - - assertFileExists $serviceFile - - serviceFile=$(normalizeStorePaths $serviceFile) - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=default.target - - [Service] - Environment=PATH=/nix/store/00000000000000000000000000000000-openssh/bin:/nix/store/00000000000000000000000000000000-git/bin - Environment=GIT_SYNC_DIRECTORY=/a/path - Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync - Environment=GIT_SYNC_REPOSITORY=git+ssh://user@example.com:/~user/path/to/repo.git - Environment=GIT_SYNC_INTERVAL=500 - ExecStart=@git-sync@/bin/git-sync-on-inotify - Restart=on-abort - - [Unit] - Description=Git Sync test - '' - } - ''; }; + + test.stubs = { + git = { name = "git"; }; + openssh = { name = "openssh"; }; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/git-sync-test.service + + assertFileExists $serviceFile + + serviceFile=$(normalizeStorePaths $serviceFile) + assertFileContent $serviceFile ${ + builtins.toFile "expected" '' + [Install] + WantedBy=default.target + + [Service] + Environment=PATH=/nix/store/00000000000000000000000000000000-openssh/bin:/nix/store/00000000000000000000000000000000-git/bin + Environment=GIT_SYNC_DIRECTORY=/a/path + Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync + Environment=GIT_SYNC_REPOSITORY=git+ssh://user@example.com:/~user/path/to/repo.git + Environment=GIT_SYNC_INTERVAL=500 + ExecStart=@git-sync@/bin/git-sync-on-inotify + Restart=on-abort + + [Unit] + Description=Git Sync test + '' + } + ''; }