mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
test: change channel operations to avoid potential goroutine leaks
In these unit tests, goroutines may leak if certain branches are chosen. This commit edits channel operations and buffer sizes, so no matter what branch is chosen, the test will end correctly. This commit doesn't change the semantics of unit tests.
This commit is contained in:
@@ -22,14 +22,14 @@ import (
|
||||
|
||||
func TestReadWriteTimeoutDialer(t *testing.T) {
|
||||
stop := make(chan struct{})
|
||||
defer func() {
|
||||
stop <- struct{}{}
|
||||
}()
|
||||
|
||||
ln, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected listen error: %v", err)
|
||||
}
|
||||
defer func() {
|
||||
stop <- struct{}{}
|
||||
}()
|
||||
ts := testBlockingServer{ln, 2, stop}
|
||||
go ts.Start(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user