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 2018-08-21 12:21:14 +02:00
parent 06c683d48d
commit 862c7ae223
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -221,10 +221,17 @@ func TestChannelArbitratorLocalForceClose(t *testing.T) {
select {
case <-respChan:
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
select {
case err := <-errChan:
t.Fatalf("error force closing channel: %v", err)
case <-time.After(15 * time.Second):
t.Fatalf("did not receive reponse")
if err != nil {
t.Fatalf("error force closing channel: %v", err)
}
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
// 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.
select {
case <-respChan:
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
select {
case err := <-errChan:
t.Fatalf("error force closing channel: %v", err)
case <-time.After(15 * time.Second):
if err != nil {
t.Fatalf("error force closing channel: %v", err)
}
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
@ -396,9 +410,16 @@ func TestChannelArbitratorLocalForceDoubleSpend(t *testing.T) {
// Wait for a response to the force close.
select {
case <-respChan:
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}
select {
case err := <-errChan:
t.Fatalf("error force closing channel: %v", err)
case <-time.After(15 * time.Second):
if err != nil {
t.Fatalf("error force closing channel: %v", err)
}
case <-time.After(5 * time.Second):
t.Fatalf("no response received")
}