htlcswitch: clean up test resources and temporary files

The htlcswitch tests were creating temporary database files
but failing to clean them up.

We fix this by making it obvious when temporary db files are
created, and cleaning up those resources where necessary in
the tests.
This commit is contained in:
kklash
2022-08-15 20:20:47 -07:00
parent 406fc86f38
commit 63428de6e5
6 changed files with 84 additions and 50 deletions

View File

@@ -628,6 +628,7 @@ func makeCircuitDB(t *testing.T, path string) *channeldb.DB {
db, err := channeldb.Open(path)
require.NoError(t, err, "unable to open channel db")
t.Cleanup(func() { db.Close() })
return db
}