nixosTests.forgejo: test git wire protocol version
Co-Authored-By: networkException <git@nwex.de>
This commit is contained in:
parent
402b5c67a8
commit
98ebe7b877
|
@ -77,6 +77,7 @@ let
|
||||||
dumpFile = with nodes.server.specialisation.dump.configuration.services.forgejo.dump; "${backupDir}/${file}";
|
dumpFile = with nodes.server.specialisation.dump.configuration.services.forgejo.dump; "${backupDir}/${file}";
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
|
import json
|
||||||
GIT_SSH_COMMAND = "ssh -i $HOME/.ssh/privk -o StrictHostKeyChecking=no"
|
GIT_SSH_COMMAND = "ssh -i $HOME/.ssh/privk -o StrictHostKeyChecking=no"
|
||||||
REPO = "forgejo@server:test/repo"
|
REPO = "forgejo@server:test/repo"
|
||||||
PRIVK = "${snakeOilPrivateKey}"
|
PRIVK = "${snakeOilPrivateKey}"
|
||||||
|
@ -146,6 +147,11 @@ let
|
||||||
client2.succeed(f"GIT_SSH_COMMAND='{GIT_SSH_COMMAND}' git clone {REPO}")
|
client2.succeed(f"GIT_SSH_COMMAND='{GIT_SSH_COMMAND}' git clone {REPO}")
|
||||||
client2.succeed('test "$(cat repo/testfile | xargs echo -n)" = "hello world"')
|
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(
|
server.wait_until_succeeds(
|
||||||
'test "$(curl http://localhost:3000/api/v1/repos/test/repo/commits '
|
'test "$(curl http://localhost:3000/api/v1/repos/test/repo/commits '
|
||||||
+ '-H "Accept: application/json" | jq length)" = "1"',
|
+ '-H "Accept: application/json" | jq length)" = "1"',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user