contractcourt/channel_arbitrator test: check both respChan and errChan

// Both are sent on, so in some cases we would read from errChan first,
making the test fail.
This commit is contained in:
Johan T. Halseth committed 2018-08-22 23:51:04 +02:00
1 parent 06c683d48d
commit 862c7ae223
1 file changed
+25 -4
+25 -4
View File
@@ -221,10 +221,17 @@ func TestChannelArbitratorLocalForceClose(t *testing.T) {
select { select {
case <-respChan: case <-respChan:
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
select {
case err := <-errChan: case err := <-errChan:
if err != nil {
t.Fatalf("error force closing channel: %v", err) t.Fatalf("error force closing channel: %v", err)
case <-time.After(15 * time.Second): }
t.Fatalf("did not receive reponse") case <-time.After(5 * time.Second):
t.Fatalf("no response received")
} }
// After broadcasting the close tx, it should be in state // After broadcasting the close tx, it should be in state
@@ -308,9 +315,16 @@ func TestChannelArbitratorLocalForceCloseRemoteConfirmed(t *testing.T) {
// Wait for a response to the force close. // Wait for a response to the force close.
select { select {
case <-respChan: case <-respChan:
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
select {
case err := <-errChan: case err := <-errChan:
if err != nil {
t.Fatalf("error force closing channel: %v", err) t.Fatalf("error force closing channel: %v", err)
case <-time.After(15 * time.Second): }
case <-time.After(5 * time.Second):
t.Fatalf("no response received") t.Fatalf("no response received")
} }
@@ -396,9 +410,16 @@ func TestChannelArbitratorLocalForceDoubleSpend(t *testing.T) {
// Wait for a response to the force close. // Wait for a response to the force close.
select { select {
case <-respChan: case <-respChan:
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
select {
case err := <-errChan: case err := <-errChan:
if err != nil {
t.Fatalf("error force closing channel: %v", err) t.Fatalf("error force closing channel: %v", err)
case <-time.After(15 * time.Second): }
case <-time.After(5 * time.Second):
t.Fatalf("no response received") t.Fatalf("no response received")
} }