1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 01:12:24 +08:00

swarm test: reporting errors fix

This commit is contained in:
Juan Batiz-Benet
2015-01-01 07:02:16 -08:00
parent 293ea03eb0
commit 6ad158dd14

View File

@ -139,7 +139,10 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
for k := 0; k < MsgNum; k++ { // with k messages
msg := "ping"
log.Debugf("%s %s %s (%d)", s1.local, msg, p, k)
stream.Write([]byte(msg))
if _, err := stream.Write([]byte(msg)); err != nil {
errChan <- err
continue
}
}
// read it later
@ -200,7 +203,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
// check any errors (blocks till consumer is done)
for err := range errChan {
if err != nil {
t.Fatal(err.Error())
t.Error(err.Error())
}
}