Skip to content
Myr

Update gin_integration_test.go (#2341)

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

* Update gin_integration_test.go TestUnixSocket fails if you run it twice in a row. This is due to the unix socket file persisting. Added defer to clean up. Whats unclear is the following test TestBadUnixSocket I suspect is just looking for cruft maybe from a prior test or defaults not working, I have not enough background to say. * Update gin_integration_test.go I believe there is some tab issue here, tried to manual overwrite it now. * Update gin_integration_test.go squash you dang spaces!!!

authored by Ronald Petty · committed by GitHub · parent be4ba7d · Browse files · 1 file+6 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+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:gin_integration_test.go+6 added-2 removed
144 unmodified lines
145146func TestUnixSocket(t *testing.T) {147 router := New()148149 unixTestSocket := "/tmp/unix_unit_test"150151 defer os.Remove(unixTestSocket)152153 go func() {154 router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") })151 assert.NoError(t, router.RunUnix("/tmp/unix_unit_test"))155 assert.NoError(t, router.RunUnix(unixTestSocket))156 }()157 // have to wait for the goroutine to start and run the server158 // otherwise the main thread will complete159 time.Sleep(5 * time.Millisecond)160157 c, err := net.Dial("unix", "/tmp/unix_unit_test")161 c, err := net.Dial("unix", unixTestSocket)162 assert.NoError(t, err)163164 fmt.Fprint(c, "GET /example HTTP/1.0\r\n\r\n")165 scanner := bufio.NewScanner(c)
141 unmodified lines