Skip to content

Commit

Permalink
chore: Fix potential clean-up issue in test
Browse files Browse the repository at this point in the history
On Windows, the temporary directory cannot be removed until the files in
it are closed.
  • Loading branch information
twpayne committed Jan 5, 2025
1 parent 0c9a43d commit dfcd55e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/chezmoi/persistentstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func testPersistentState(t *testing.T, constructor func() PersistentState) {
)

s1 := constructor()
defer s1.Close()

assert.NoError(t, s1.Delete(bucket1, value))

Expand All @@ -42,6 +43,8 @@ func testPersistentState(t *testing.T, constructor func() PersistentState) {
}))

s2 := constructor()
defer s2.Close()

assert.NoError(t, s1.CopyTo(s2))
actualValue, err = s2.Get(bucket1, key)
assert.NoError(t, err)
Expand Down

0 comments on commit dfcd55e

Please sign in to comment.