Skip to content
Myr

fix test - auto choose port number (#1719)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Dmitry Kutakov · committed by thinkerou · parent 49e4b0c · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:gin_integration_test.go+2 added-2 removed
135 unmodified lines
136137func TestFileDescriptor(t *testing.T) {138 router := New()139140 addr, err := net.ResolveTCPAddr("tcp", ":8000")140 addr, err := net.ResolveTCPAddr("tcp", "localhost:0")141 assert.NoError(t, err)142 listener, err := net.ListenTCP("tcp", addr)143 assert.NoError(t, err)144 socketFile, err := listener.File()
6 unmodified lines
151 // have to wait for the goroutine to start and run the server152 // otherwise the main thread will complete153 time.Sleep(5 * time.Millisecond)154155 c, err := net.Dial("tcp", "localhost:8000")155 c, err := net.Dial("tcp", listener.Addr().String())156 assert.NoError(t, err)157158 fmt.Fprintf(c, "GET /example HTTP/1.0\r\n\r\n")159 scanner := bufio.NewScanner(c)
60 unmodified lines