Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ func resetSharedStateDB() error {
// Reset any pre-existing global DB state (e.g. left by an init or an
// isolated test cleanup) before pointing the package at the shared suite DB.
state.CloseDB()
err := config.EnsureDirs()
if err := config.EnsureDirs(); err != nil {
return err
}
state.Configure(filepath.Join(config.GetStateDir(), "surge.db"))
return err
return nil
}

func TestMain(m *testing.M) {
Expand All @@ -35,6 +37,7 @@ func TestMain(m *testing.M) {

if ensureErr := resetSharedStateDB(); ensureErr != nil {
fmt.Fprintf(os.Stderr, "TestMain: failed to create isolated Surge test directories: %v\n", ensureErr)
_ = os.RemoveAll(tmpDir)
os.Exit(1)
}
}
Expand Down
Loading