mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-22 09:21:32 +00:00
Replace ResultsCh with ResponsesCh
This commit is contained in:
@ -125,8 +125,7 @@ func TestWSClientReconnectFailure(t *testing.T) {
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-c.ResultsCh:
|
||||
case <-c.ErrorsCh:
|
||||
case <-c.ResponsesCh:
|
||||
case <-c.Quit:
|
||||
return
|
||||
}
|
||||
@ -163,7 +162,7 @@ func TestWSClientReconnectFailure(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNotBlockingOnStop(t *testing.T) {
|
||||
timeout := 2 *time.Second
|
||||
timeout := 2 * time.Second
|
||||
s := httptest.NewServer(&myHandler{})
|
||||
c := startClient(t, s.Listener.Addr())
|
||||
c.Call(context.Background(), "a", make(map[string]interface{}))
|
||||
@ -171,10 +170,10 @@ func TestNotBlockingOnStop(t *testing.T) {
|
||||
time.Sleep(time.Second)
|
||||
passCh := make(chan struct{})
|
||||
go func() {
|
||||
// Unless we have a non-blocking write to ResultsCh from readRoutine
|
||||
// Unless we have a non-blocking write to ResponsesCh from readRoutine
|
||||
// this blocks forever ont the waitgroup
|
||||
c.Stop()
|
||||
passCh <- struct{}{}
|
||||
c.Stop()
|
||||
passCh <- struct{}{}
|
||||
}()
|
||||
select {
|
||||
case <-passCh:
|
||||
@ -201,13 +200,12 @@ func call(t *testing.T, method string, c *WSClient) {
|
||||
func callWgDoneOnResult(t *testing.T, c *WSClient, wg *sync.WaitGroup) {
|
||||
for {
|
||||
select {
|
||||
case res := <-c.ResultsCh:
|
||||
if res != nil {
|
||||
wg.Done()
|
||||
case resp := <-c.ResponsesCh:
|
||||
if resp.Error != nil {
|
||||
t.Fatalf("unexpected error: %v", resp.Error)
|
||||
}
|
||||
case err := <-c.ErrorsCh:
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
if *resp.Result != nil {
|
||||
wg.Done()
|
||||
}
|
||||
case <-c.Quit:
|
||||
return
|
||||
|
Reference in New Issue
Block a user