lntemp+lntest: use t.Cleanup to register cleanup functions
This commit is contained in:
6 files changed
+14
-24
No files matched your search
@@ -401,8 +401,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) {
|
||||
for _, testCase := range testCases {
|
||||
tc := testCase
|
||||
success := ht.Run(tc.name, func(t *testing.T) {
|
||||
h, cleanup := ht.Subtest(t)
|
||||
defer cleanup()
|
||||
h := ht.Subtest(t)
|
||||
|
||||
runChanRestoreScenarioBasic(h, tc.restoreMethod)
|
||||
})
|
||||
@@ -445,17 +444,15 @@ func testChannelBackupRestoreUnconfirmed(ht *lntemp.HarnessTest) {
|
||||
// Use the channel backup file that contains an unconfirmed channel and
|
||||
// make sure recovery works as well.
|
||||
ht.Run("restore unconfirmed channel file", func(t *testing.T) {
|
||||
st, cleanup := ht.Subtest(t)
|
||||
st := ht.Subtest(t)
|
||||
runChanRestoreScenarioUnConfirmed(st, true)
|
||||
cleanup()
|
||||
})
|
||||
|
||||
// Create a backup using RPC that contains an unconfirmed channel and
|
||||
// make sure recovery works as well.
|
||||
ht.Run("restore unconfirmed channel RPC", func(t *testing.T) {
|
||||
st, cleanup := ht.Subtest(t)
|
||||
st := ht.Subtest(t)
|
||||
runChanRestoreScenarioUnConfirmed(st, false)
|
||||
cleanup()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -568,8 +565,7 @@ func testChannelBackupRestoreCommitTypes(ht *lntemp.HarnessTest) {
|
||||
for _, testCase := range testCases {
|
||||
tc := testCase
|
||||
success := ht.Run(tc.name, func(t *testing.T) {
|
||||
h, cleanup := ht.Subtest(t)
|
||||
defer cleanup()
|
||||
h := ht.Subtest(t)
|
||||
|
||||
runChanRestoreScenarioCommitTypes(
|
||||
h, tc.ct, tc.zeroConf,
|
||||
@@ -671,17 +667,15 @@ func testChannelBackupRestoreForceClose(ht *lntemp.HarnessTest) {
|
||||
// Restore a channel that was force closed by dave just before going
|
||||
// offline.
|
||||
ht.Run("from backup file anchors", func(t *testing.T) {
|
||||
st, cleanup := ht.Subtest(t)
|
||||
st := ht.Subtest(t)
|
||||
runChanRestoreScenarioForceClose(st, false)
|
||||
cleanup()
|
||||
})
|
||||
|
||||
// Restore a zero-conf anchors channel that was force closed by dave
|
||||
// just before going offline.
|
||||
ht.Run("from backup file anchors w/ zero-conf", func(t *testing.T) {
|
||||
st, cleanup := ht.Subtest(t)
|
||||
st := ht.Subtest(t)
|
||||
runChanRestoreScenarioForceClose(st, true)
|
||||
cleanup()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -127,8 +127,7 @@ test:
|
||||
"carol_commit=%v,dave_commit=%v", cc, dc,
|
||||
)
|
||||
success := ht.Run(testName, func(t *testing.T) {
|
||||
st, cleanup := ht.Subtest(t)
|
||||
defer cleanup()
|
||||
st := ht.Subtest(t)
|
||||
testFunding(st, cc, dc)
|
||||
})
|
||||
|
||||
|
||||
@@ -171,8 +171,7 @@ func runMultiHopHtlcClaimTest(ht *lntemp.HarnessTest, tester caseRunner) {
|
||||
}
|
||||
|
||||
s := ht.Run(name, func(t1 *testing.T) {
|
||||
st, cleanup := ht.Subtest(t1)
|
||||
defer cleanup()
|
||||
st := ht.Subtest(t1)
|
||||
|
||||
alice := st.NewNode("Alice", args)
|
||||
bob := st.NewNode("Bob", args)
|
||||
|
||||
@@ -94,8 +94,7 @@ func TestLightningNetworkDaemonTemp(t *testing.T) {
|
||||
// Create a separate harness test for the testcase to
|
||||
// avoid overwriting the external harness test that is
|
||||
// tied to the parent test.
|
||||
ht, cleanup := harnessTest.Subtest(t1)
|
||||
defer cleanup()
|
||||
ht := harnessTest.Subtest(t1)
|
||||
|
||||
// TODO(yy): split log files.
|
||||
cleanTestCaseName := strings.ReplaceAll(
|
||||
|
||||
Reference in new issue
Block a user