mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-10-28 03:29:08 +01:00
tests: correctly close filesystems
This commit is contained in:
@@ -43,6 +43,11 @@ func runExport(ctx context.Context, flags exportFlags) error {
|
||||
return fmt.Errorf("failed to initialize storage: %w", err)
|
||||
}
|
||||
|
||||
// Close filesystem storage handles before the command exits
|
||||
defer func() {
|
||||
_ = storage.Close()
|
||||
}()
|
||||
|
||||
exportService := service.NewExportService(db, storage)
|
||||
|
||||
var w io.Writer
|
||||
|
||||
@@ -88,6 +88,11 @@ func runImport(ctx context.Context, flags importFlags) error {
|
||||
return fmt.Errorf("failed to initialize storage: %w", err)
|
||||
}
|
||||
|
||||
// Close filesystem storage handles before the command exits
|
||||
defer func() {
|
||||
_ = storage.Close()
|
||||
}()
|
||||
|
||||
importService := service.NewImportService(db, storage)
|
||||
err = importService.ImportFromZip(ctx, &zipReader.Reader)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user