summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authoremilylange <git@emilylange.de>2023-10-24 03:29:08 +0200
committeremilylange <git@emilylange.de>2023-10-24 03:32:03 +0200
commit98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd (patch)
tree2017cdd3c3b97b81fbe31adcc382da87f3f4c9b2 /nixos
parent402b5c67a8ce96709d31c40e000bfdd339b23409 (diff)
downloadnixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.tar
nixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.tar.gz
nixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.tar.bz2
nixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.tar.lz
nixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.tar.xz
nixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.tar.zst
nixpkgs-98ebe7b877a3b9bb8b202fb2b9dafcf7ec0e16dd.zip
nixosTests.forgejo: test git wire protocol version
Co-Authored-By: networkException <git@nwex.de>
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/forgejo.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/nixos/tests/forgejo.nix b/nixos/tests/forgejo.nix
index 0f7e1585f3d..6acd6acb50f 100644
--- a/nixos/tests/forgejo.nix
+++ b/nixos/tests/forgejo.nix
@@ -77,6 +77,7 @@ let
         dumpFile = with nodes.server.specialisation.dump.configuration.services.forgejo.dump; "${backupDir}/${file}";
       in
       ''
+        import json
         GIT_SSH_COMMAND = "ssh -i $HOME/.ssh/privk -o StrictHostKeyChecking=no"
         REPO = "forgejo@server:test/repo"
         PRIVK = "${snakeOilPrivateKey}"
@@ -146,6 +147,11 @@ let
         client2.succeed(f"GIT_SSH_COMMAND='{GIT_SSH_COMMAND}' git clone {REPO}")
         client2.succeed('test "$(cat repo/testfile | xargs echo -n)" = "hello world"')
 
+        with subtest("Testing git protocol version=2 over ssh"):
+            git_protocol = client2.succeed(f"GIT_SSH_COMMAND='{GIT_SSH_COMMAND}' GIT_TRACE2_EVENT=true git -C repo fetch |& grep negotiated-version")
+            version = json.loads(git_protocol).get("value")
+            assert version == "2", f"git did not negotiate protocol version 2, but version {version} instead."
+
         server.wait_until_succeeds(
             'test "$(curl http://localhost:3000/api/v1/repos/test/repo/commits '
             + '-H "Accept: application/json" | jq length)" = "1"',