mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 01:36:24 +01:00
lntest: shutdown running nodes when test fails
Fixes the zip log files failure we see.
This commit is contained in:
parent
0e8a525f94
commit
d97f52d12a
1 changed files with 13 additions and 1 deletions
|
@ -351,6 +351,7 @@ func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest {
|
|||
// Don't bother run the cleanups if the test is failed.
|
||||
if st.Failed() {
|
||||
st.Log("test failed, skipped cleanup")
|
||||
st.shutdownAllNodes()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -391,10 +392,21 @@ func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest {
|
|||
|
||||
// shutdownNonStandbyNodes will shutdown any non-standby nodes.
|
||||
func (h *HarnessTest) shutdownNonStandbyNodes() {
|
||||
h.shutdownNodes(true)
|
||||
}
|
||||
|
||||
// shutdownAllNodes will shutdown all running nodes.
|
||||
func (h *HarnessTest) shutdownAllNodes() {
|
||||
h.shutdownNodes(false)
|
||||
}
|
||||
|
||||
// shutdownNodes will shutdown any non-standby nodes. If skipStandby is false,
|
||||
// all the standby nodes will be shutdown too.
|
||||
func (h *HarnessTest) shutdownNodes(skipStandby bool) {
|
||||
for nid, node := range h.manager.activeNodes {
|
||||
// If it's a standby node, skip.
|
||||
_, ok := h.manager.standbyNodes[nid]
|
||||
if ok {
|
||||
if ok && skipStandby {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue