summary refs log tree commit diff
path: root/nixos/tests/gitdaemon.nix
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2021-05-02 21:58:43 +0000
committerLuke Granger-Brown <git@lukegb.com>2021-05-02 21:58:43 +0000
commitf2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031 (patch)
tree9d5b73ddab665f270ed4b63e9a250c8d1924ab85 /nixos/tests/gitdaemon.nix
parente3ad419b87019f7a3cbfd8c8cda88b104a0c7c9b (diff)
downloadnixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.tar
nixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.tar.gz
nixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.tar.bz2
nixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.tar.lz
nixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.tar.xz
nixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.tar.zst
nixpkgs-f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031.zip
nixos/tests/gitdaemon: deflake by using systemd-tmpfiles
git-daemon won't start up if its project directory (here /git) doesn't
exist. If we try to create it using the test harness, then we're racing
whether we manage to connect to the backdoor vs. the startup speed of
git-daemon.

Instead, use systemd-tmpfiles, which is guaranteed(?) to run before
network.target and thus before git-daemon.service starts.
Diffstat (limited to 'nixos/tests/gitdaemon.nix')
-rw-r--r--nixos/tests/gitdaemon.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/tests/gitdaemon.nix b/nixos/tests/gitdaemon.nix
index d0156fb9a49..bb07b6e97b7 100644
--- a/nixos/tests/gitdaemon.nix
+++ b/nixos/tests/gitdaemon.nix
@@ -18,6 +18,11 @@ in {
 
         environment.systemPackages = [ pkgs.git ];
 
+        systemd.tmpfiles.rules = [
+          # type path mode user group age arg
+          " d    /git 0755 root root  -   -"
+        ];
+
         services.gitDaemon = {
           enable = true;
           basePath = "/git";
@@ -35,7 +40,6 @@ in {
 
     with subtest("create project.git"):
         server.succeed(
-            "mkdir /git",
             "git init --bare /git/project.git",
             "touch /git/project.git/git-daemon-export-ok",
         )