Skip to content

Commit 4c98874

Browse files
committed
Abort background routine when test ends
Signed-off-by: Yacov Manevich <yacovm@il.ibm.com>
1 parent a2d2cad commit 4c98874

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/basic_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,11 @@ func TestBlacklistAndRedemption(t *testing.T) {
16661666
rand.Read(txID)
16671667
nodes[1].Submit(Request{ID: hex.EncodeToString(txID), ClientID: "alice"})
16681668
for i := 0; i < len(nodes); i++ {
1669-
<-nodes[i].Delivered
1669+
select {
1670+
case <-nodes[i].Delivered:
1671+
case <-stop:
1672+
return
1673+
}
16701674
}
16711675
md := &smartbftprotos.ViewMetadata{}
16721676
err = proto.Unmarshal(nodes[1].lastDecision.Proposal.Metadata, md)
@@ -1786,7 +1790,11 @@ func TestBlacklistMultipleViewChanges(t *testing.T) {
17861790
rand.Read(txID)
17871791
nodes[3].Submit(Request{ID: hex.EncodeToString(txID), ClientID: "alice"})
17881792
for i := 0; i < len(nodes); i++ {
1789-
<-nodes[i].Delivered
1793+
select {
1794+
case <-nodes[i].Delivered:
1795+
case <-stop:
1796+
return
1797+
}
17901798
}
17911799
md := &smartbftprotos.ViewMetadata{}
17921800
err = proto.Unmarshal(nodes[3].lastDecision.Proposal.Metadata, md)

0 commit comments

Comments
 (0)