From f2a91ec2b7cbb0b24c99d28a8622ecc72a0ad031 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 2 May 2021 21:58:43 +0000 Subject: [PATCH] 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. --- nixos/tests/gitdaemon.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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", )