itest: manage context inside EnsureConnected

This commit is contained in:
yyforyongyu committed 2021-08-24 11:06:44 +08:00
1 parent d10d1e3e24
commit 74f8fe482d
18 files changed
+46 -82

No files matched your search

+4 -2
View File
@@ -548,8 +548,10 @@ tryconnect:
// behave the same as ConnectNodes. If a pending connection request has already
// been made, the method will block until the two nodes appear in each other's
// peers list, or until the 15s timeout expires.
func (n *NetworkHarness) EnsureConnected(ctx context.Context,
t *testing.T, a, b *HarnessNode) {
func (n *NetworkHarness) EnsureConnected(t *testing.T, a, b *HarnessNode) {
ctxb := context.Background()
ctx, cancel := context.WithTimeout(ctxb, DefaultTimeout)
defer cancel()
// errConnectionRequested is used to signal that a connection was
// requested successfully, which is distinct from already being