8000 Improve transport tests by onee-only · Pull Request #1586 · go-git/go-git · GitHub
[go: up one dir, main page]

Skip to content

Improve transport tests #1586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions internal/transport/http/proxy_test.go

This file was deleted.

130 changes: 0 additions & 130 deletions internal/transport/http/test/test_utils.go

This file was deleted.

99 changes: 0 additions & 99 deletions internal/transport/ssh/test/proxy_test.go

This file was deleted.

83 changes: 0 additions & 83 deletions internal/transport/ssh/test/test_utils.go

This file was deleted.

17 changes: 17 additions & 0 deletions internal/transport/test/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,20 @@ func FreePort() (int, error) {

return l.Addr().(*net.TCPAddr).Port, l.Close()
}

// ListenTCP listens localhost:0.
// It reserves the listener to be closed on t.CleanUp.
func ListenTCP(t testing.TB) *net.TCPListener {
t.Helper()
l, err := net.Listen("tcp", "localhost:0")
require.NoError(t, err)

t.Cleanup(func() {
err := l.Close()
if err != nil {
require.ErrorIs(t, err, net.ErrClosed)
}
})

return l.(*net.TCPListener)
}
Loading
Loading
0