mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-21 22:32:33 +02:00
itest: remove loop in wsTestCaseBiDirectionalSubscription
So we know which open channel operation failed.
This commit is contained in:
parent
782edde213
commit
c07162603d
@ -440,7 +440,6 @@ func wsTestCaseBiDirectionalSubscription(ht *lntest.HarnessTest) {
|
|||||||
msgChan := make(chan *lnrpc.ChannelAcceptResponse, 1)
|
msgChan := make(chan *lnrpc.ChannelAcceptResponse, 1)
|
||||||
errChan := make(chan error)
|
errChan := make(chan error)
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
timeout := time.After(defaultTimeout)
|
|
||||||
|
|
||||||
// We want to read messages over and over again. We just accept any
|
// We want to read messages over and over again. We just accept any
|
||||||
// channels that are opened.
|
// channels that are opened.
|
||||||
@ -506,6 +505,7 @@ func wsTestCaseBiDirectionalSubscription(ht *lntest.HarnessTest) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ht.Logf("Finish writing message %s", resMsg)
|
||||||
|
|
||||||
// Also send the message on our message channel to make
|
// Also send the message on our message channel to make
|
||||||
// sure we count it as successful.
|
// sure we count it as successful.
|
||||||
@ -525,23 +525,27 @@ func wsTestCaseBiDirectionalSubscription(ht *lntest.HarnessTest) {
|
|||||||
bob := ht.NewNodeWithCoins("Bob", nil)
|
bob := ht.NewNodeWithCoins("Bob", nil)
|
||||||
ht.EnsureConnected(alice, bob)
|
ht.EnsureConnected(alice, bob)
|
||||||
|
|
||||||
// Open 3 channels to make sure multiple requests and responses can be
|
assertMsgReceived := func() {
|
||||||
// sent over the web socket.
|
|
||||||
const numChannels = 3
|
|
||||||
for i := 0; i < numChannels; i++ {
|
|
||||||
ht.OpenChannel(
|
|
||||||
bob, alice, lntest.OpenChannelParams{Amt: 500000},
|
|
||||||
)
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-msgChan:
|
case <-msgChan:
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
ht.Fatalf("Received error from WS: %v", err)
|
ht.Fatalf("Received error from WS: %v", err)
|
||||||
|
|
||||||
case <-timeout:
|
case <-time.After(defaultTimeout):
|
||||||
ht.Fatalf("Timeout before message was received")
|
ht.Fatalf("Timeout before message was received")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open 3 channels to make sure multiple requests and responses can be
|
||||||
|
// sent over the web socket.
|
||||||
|
ht.OpenChannel(bob, alice, lntest.OpenChannelParams{Amt: 500000})
|
||||||
|
assertMsgReceived()
|
||||||
|
|
||||||
|
ht.OpenChannel(bob, alice, lntest.OpenChannelParams{Amt: 500000})
|
||||||
|
assertMsgReceived()
|
||||||
|
|
||||||
|
ht.OpenChannel(bob, alice, lntest.OpenChannelParams{Amt: 500000})
|
||||||
|
assertMsgReceived()
|
||||||
}
|
}
|
||||||
|
|
||||||
func wsTestPingPongTimeout(ht *lntest.HarnessTest) {
|
func wsTestPingPongTimeout(ht *lntest.HarnessTest) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user