OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / tendermint / abci / client / socket_client_test.go
1 package abcicli_test
2
3 import (
4         "errors"
5         "testing"
6         "time"
7
8         "github.com/tendermint/abci/client"
9 )
10
11 func TestSocketClientStopForErrorDeadlock(t *testing.T) {
12         c := abcicli.NewSocketClient(":80", false)
13         err := errors.New("foo-tendermint")
14
15         // See Issue https://github.com/tendermint/abci/issues/114
16         doneChan := make(chan bool)
17         go func() {
18                 defer close(doneChan)
19                 c.StopForError(err)
20                 c.StopForError(err)
21         }()
22
23         select {
24         case <-doneChan:
25         case <-time.After(time.Second * 4):
26                 t.Fatalf("Test took too long, potential deadlock still exists")
27         }
28 }