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.
master
Luke Granger-Brown 2021-05-02 21:58:43 +00:00
parent e3ad419b87
commit f2a91ec2b7
1 changed files with 5 additions and 1 deletions

View File

@ -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",
)