mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fixing goroutine leaks in testServer
This commit is contained in:
@@ -96,6 +96,7 @@ func testServer(t *testing.T, scheme string, secure bool, delayTx bool) {
|
||||
writec <- data1
|
||||
now := time.Now()
|
||||
if d := <-recvc; !bytes.Equal(data1, d) {
|
||||
close(writec)
|
||||
t.Fatalf("expected %q, got %q", string(data1), string(d))
|
||||
}
|
||||
took1 := time.Since(now)
|
||||
@@ -110,6 +111,7 @@ func testServer(t *testing.T, scheme string, secure bool, delayTx bool) {
|
||||
writec <- data2
|
||||
now = time.Now()
|
||||
if d := <-recvc; !bytes.Equal(data2, d) {
|
||||
close(writec)
|
||||
t.Fatalf("expected %q, got %q", string(data2), string(d))
|
||||
}
|
||||
took2 := time.Since(now)
|
||||
@@ -122,6 +124,7 @@ func testServer(t *testing.T, scheme string, secure bool, delayTx bool) {
|
||||
if delayTx {
|
||||
p.UndelayTx()
|
||||
if took2 < lat-rv {
|
||||
close(writec)
|
||||
t.Fatalf("expected took2 %v (with latency) > delay: %v", took2, lat-rv)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user