mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 10:17:37 +02:00
test: keep integration ssh independent of user ssh config (#39600)
The SSH integration tests read the user's `~/.ssh/config`, so options like `ControlMaster` reused a connection authenticated with another test's key and the tests failed with "Cannot find key". Pass `-F none` so ssh reads no config files.
This commit is contained in:
1 parent
49adfd065d
commit
fc44404843
1 file changed
+2
-2
@@ -38,13 +38,13 @@ func withKeyFile(t *testing.T, keyname string, callback func(string)) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
err = os.WriteFile(filepath.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
|
err = os.WriteFile(filepath.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
|
||||||
"ssh -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\" \"$@\""), 0o700)
|
"ssh -F none -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\" \"$@\""), 0o700)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Setup ssh wrapper
|
// Setup ssh wrapper
|
||||||
t.Setenv("GIT_SSH", filepath.Join(tmpDir, "ssh"))
|
t.Setenv("GIT_SSH", filepath.Join(tmpDir, "ssh"))
|
||||||
t.Setenv("GIT_SSH_COMMAND",
|
t.Setenv("GIT_SSH_COMMAND",
|
||||||
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i \""+keyFile+"\"")
|
"ssh -F none -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i \""+keyFile+"\"")
|
||||||
t.Setenv("GIT_SSH_VARIANT", "ssh")
|
t.Setenv("GIT_SSH_VARIANT", "ssh")
|
||||||
|
|
||||||
callback(keyFile)
|
callback(keyFile)
|
||||||
|
|||||||
Reference in new issue
Block a user