mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
TestMain: Handle "defer" before os.Exit #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -22,7 +22,6 @@ func TestMain(m *testing.M) {
|
||||
fs.PurgeTestDbFiles(".", false)
|
||||
|
||||
c := config.TestConfig()
|
||||
defer c.CloseDb()
|
||||
|
||||
get.SetConfig(c)
|
||||
photoprism.SetConfig(c)
|
||||
@@ -30,6 +29,10 @@ func TestMain(m *testing.M) {
|
||||
// Run unit tests.
|
||||
code := m.Run()
|
||||
|
||||
if err := c.CloseDb(); err != nil {
|
||||
log.Errorf("close db: %v", err)
|
||||
}
|
||||
|
||||
// Remove temporary SQLite files after running the tests.
|
||||
fs.PurgeTestDbFiles(".", false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user