Skip to content

Commit

Permalink
fix test - auto choose port number (gin-gonic#1719)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkd authored and thinkerou committed Dec 28, 2018
1 parent 49e4b0c commit 8073685
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gin_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestBadUnixSocket(t *testing.T) {
func TestFileDescriptor(t *testing.T) {
router := New()

addr, err := net.ResolveTCPAddr("tcp", ":8000")
addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
assert.NoError(t, err)
listener, err := net.ListenTCP("tcp", addr)
assert.NoError(t, err)
Expand All @@ -152,7 +152,7 @@ func TestFileDescriptor(t *testing.T) {
// otherwise the main thread will complete
time.Sleep(5 * time.Millisecond)

c, err := net.Dial("tcp", "localhost:8000")
c, err := net.Dial("tcp", listener.Addr().String())
assert.NoError(t, err)

fmt.Fprintf(c, "GET /example HTTP/1.0\r\n\r\n")
Expand Down

0 comments on commit 8073685

Please sign in to comment.