mirror of
https://github.com/minio/minio.git
synced 2025-01-25 13:43:17 -05:00
Fix data race bug in the testcase TestHTTPListenerAcceptParallel (#5043)
This commit is contained in:
parent
9c16f73334
commit
db1edfe487
@ -734,7 +734,6 @@ func TestHTTPListenerAcceptParallel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleConnection := func(i int, wg *sync.WaitGroup, serverConn net.Conn, request, reply string) {
|
handleConnection := func(i int, wg *sync.WaitGroup, serverConn net.Conn, request, reply string) {
|
||||||
wg.Add(1)
|
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
received, err := bufio.NewReader(serverConn).ReadString('\n')
|
received, err := bufio.NewReader(serverConn).ReadString('\n')
|
||||||
@ -778,12 +777,14 @@ func TestHTTPListenerAcceptParallel(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Test %d: accept: expected = <nil>, got = %v", i+1, err)
|
t.Fatalf("Test %d: accept: expected = <nil>, got = %v", i+1, err)
|
||||||
}
|
}
|
||||||
|
wg.Add(1)
|
||||||
go handleConnection(i, &wg, serverConn, "GET /2 HTTP/1.0\n", testCase.reply)
|
go handleConnection(i, &wg, serverConn, "GET /2 HTTP/1.0\n", testCase.reply)
|
||||||
|
|
||||||
serverConn, err = listener.Accept()
|
serverConn, err = listener.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Test %d: accept: expected = <nil>, got = %v", i+1, err)
|
t.Fatalf("Test %d: accept: expected = <nil>, got = %v", i+1, err)
|
||||||
}
|
}
|
||||||
|
wg.Add(1)
|
||||||
go handleConnection(i, &wg, serverConn, "GET /1 HTTP/1.0\n", testCase.reply)
|
go handleConnection(i, &wg, serverConn, "GET /1 HTTP/1.0\n", testCase.reply)
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user