read from ErrorsCh also

This commit is contained in:
Anton Kaliaev 2017-03-09 17:44:00 +04:00
parent 05e1a22d5b
commit 720b74d89e
No known key found for this signature in database
GPG Key ID: 7B6881D965918214
1 changed files with 12 additions and 8 deletions

View File

@ -140,16 +140,20 @@ func testWS(t *testing.T, cl *client.WSClient) {
t.Fatal(err)
}
msg := <-cl.ResultsCh
result := new(Result)
wire.ReadJSONPtr(result, msg, &err)
if err != nil {
select {
case msg := <-cl.ResultsCh:
result := new(Result)
wire.ReadJSONPtr(result, msg, &err)
if err != nil {
t.Fatal(err)
}
got := (*result).(*ResultStatus).Value
if got != val {
t.Fatalf("Got: %v .... Expected: %v \n", got, val)
}
case err := <-cl.ErrorsCh:
t.Fatal(err)
}
got := (*result).(*ResultStatus).Value
if got != val {
t.Fatalf("Got: %v .... Expected: %v \n", got, val)
}
}
//-------------