mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
chanbackup: replace defer cleanup with t.Cleanup
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
parent
cac8f54a45
commit
5c5997935d
@ -95,11 +95,6 @@ func TestUpdateAndSwap(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
// Ensure that all created files are removed at the end of the
|
||||
// test case.
|
||||
defer os.Remove(testCase.fileName)
|
||||
defer os.Remove(testCase.tempFileName)
|
||||
|
||||
backupFile := NewMultiFile(testCase.fileName)
|
||||
|
||||
// To start with, we'll make a random byte slice that'll pose
|
||||
@ -112,10 +107,11 @@ func TestUpdateAndSwap(t *testing.T) {
|
||||
// If the old temporary file is meant to exist, then we'll
|
||||
// create it now as an empty file.
|
||||
if testCase.oldTempExists {
|
||||
_, err := os.Create(testCase.tempFileName)
|
||||
f, err := os.Create(testCase.tempFileName)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create temp file: %v", err)
|
||||
}
|
||||
require.NoError(t, f.Close())
|
||||
|
||||
// TODO(roasbeef): mock out fs calls?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user