itest+lntest: add more itest for accessman

This commit is contained in:
yyforyongyu committed 2025-06-19 16:05:59 +08:00
1 parent e003cb5d4a
commit 9caa5f220d
3 files changed
+352 -82

No files matched your search

+24 -1
View File
@@ -119,7 +119,7 @@ func (h *HarnessTest) ConnectNodes(a, b *node.HarnessNode) {
},
}
a.RPC.ConnectPeer(req)
h.AssertPeerConnected(a, b)
h.AssertConnected(a, b)
}
// ConnectNodesPerm creates a persistent connection between the two nodes and
@@ -240,6 +240,24 @@ func (h *HarnessTest) EnsureConnected(a, b *node.HarnessNode) {
h.AssertPeerConnected(b, a)
}
// ConnectNodesNoAssert creates a connection from node A to node B.
func (h *HarnessTest) ConnectNodesNoAssert(a, b *node.HarnessNode) (
*lnrpc.ConnectPeerResponse, error) {
bobInfo := b.RPC.GetInfo()
req := &lnrpc.ConnectPeerRequest{
Addr: &lnrpc.LightningAddress{
Pubkey: bobInfo.IdentityPubkey,
Host: b.Cfg.P2PAddr(),
},
}
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
return a.RPC.LN.ConnectPeer(ctxt, req)
}
// AssertNumEdges checks that an expected number of edges can be found in the
// node specified.
func (h *HarnessTest) AssertNumEdges(hn *node.HarnessNode,
@@ -1669,6 +1687,11 @@ func (h *HarnessTest) AssertPeerNotConnected(a, b *node.HarnessNode) {
// AssertNotConnected asserts that two peers are not connected.
func (h *HarnessTest) AssertNotConnected(a, b *node.HarnessNode) {
// Sleep one second before the assertion to make sure that when there's
// a RPC call to connect, that RPC call is finished before the
// assertion.
time.Sleep(1 * time.Second)
h.AssertPeerNotConnected(a, b)
h.AssertPeerNotConnected(b, a)
}