at 23.05-pre 1.9 kB view raw
1import ./make-test-python.nix ({ pkgs, ... }: 2 3let 4 hashes = pkgs.writeText "hashes" '' 5 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /project/bar 6 ''; 7in { 8 name = "gitdaemon"; 9 10 meta = with pkgs.lib.maintainers; { 11 maintainers = [ tilpner ]; 12 }; 13 14 nodes = { 15 server = 16 { config, ... }: { 17 networking.firewall.allowedTCPPorts = [ config.services.gitDaemon.port ]; 18 19 environment.systemPackages = [ pkgs.git ]; 20 21 systemd.tmpfiles.rules = [ 22 # type path mode user group age arg 23 " d /git 0755 root root - -" 24 ]; 25 26 services.gitDaemon = { 27 enable = true; 28 basePath = "/git"; 29 }; 30 }; 31 32 client = 33 { pkgs, ... }: { 34 environment.systemPackages = [ pkgs.git ]; 35 }; 36 }; 37 38 testScript = '' 39 start_all() 40 41 with subtest("create project.git"): 42 server.succeed( 43 "git init --bare /git/project.git", 44 "touch /git/project.git/git-daemon-export-ok", 45 ) 46 47 with subtest("add file to project.git"): 48 server.succeed( 49 "git clone /git/project.git /project", 50 "echo foo > /project/bar", 51 "git config --global user.email 'you@example.com'", 52 "git config --global user.name 'Your Name'", 53 "git -C /project add bar", 54 "git -C /project commit -m 'quux'", 55 "git -C /project push", 56 "rm -r /project", 57 ) 58 59 with subtest("git daemon starts"): 60 server.wait_for_unit("git-daemon.service") 61 62 server.wait_for_unit("network-online.target") 63 client.wait_for_unit("network-online.target") 64 65 with subtest("client can clone project.git"): 66 client.succeed( 67 "git clone git://server/project.git /project", 68 "sha256sum -c ${hashes}", 69 ) 70 ''; 71})