Commit f2a91ec2 authored by Luke Granger-Brown's avatar Luke Granger-Brown
Browse files

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.
parent e3ad419b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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",
        )