Skip to content

Commit

Permalink
handle error in test db removal
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr committed Jan 26, 2024
1 parent 0f65bfc commit f12ff1e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/database/sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package database

import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
Expand All @@ -19,7 +20,9 @@ func init() {
}

func sqliteTestDatabaseFactory(ctx context.Context) (DB, error) {
os.Remove(sqliteDatabaseTestPath)
if err := os.Remove(sqliteDatabaseTestPath); err != nil && !os.IsNotExist(err) {
return nil, fmt.Errorf("error removing test database: %w", err)
}

db, err := OpenSQLiteDatabase(ctx, sqliteDatabaseTestPath)
if err != nil {
Expand Down

0 comments on commit f12ff1e

Please sign in to comment.