test: stabilize git ssh temp file check (#125)

This commit is contained in:
Duy /zuey/ authored and GitHub committed 2026-05-31 19:56:18 +07:00
1 parent c4b628207e
commit 131f29dff8
1 file changed
+3 -2
+3 -2
View File
@@ -160,11 +160,12 @@ func TestGitAdapter_SSH_CleanupOnExecFailure(t *testing.T) {
// TestGitAdapter_SSH_HostMismatch_NoTmpfile: rejected host mismatch must
// NOT leave an orphaned tmpfile in os.TempDir().
func TestGitAdapter_SSH_HostMismatch_NoTmpfile(t *testing.T) {
t.Parallel()
cred := sshCredFor(t, "github.com")
adapter := tools.AdapterFor("git")
// This assertion observes os.TempDir(), which is process-global. Keep it
// serial so other SSH lifecycle tests cannot create legitimate temp keys
// between the before/after snapshots.
before, _ := filepath.Glob(filepath.Join(os.TempDir(), "goclaw-gitkey-*"))
_, err := adapter.Prepare(context.Background(), nil, cred,
[]string{"clone", "git@gitlab.com:o/r.git"})