Skip to content

Commit

Permalink
Close a few handles before deleting tempdir
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed May 19, 2024
1 parent 231ed05 commit 8aa3299
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/repository/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,20 @@ func TestFileRepositoryReader(t *testing.T) {
fooData, err := io.ReadAll(fooReader)
assert.Equal(t, []byte{}, fooData)
assert.Nil(t, err)
fooReader.Close()

// Make sure we can read the file with data.
barReader, err := storage.Reader(bar)
assert.Nil(t, err)
barData, err := io.ReadAll(barReader)
assert.Equal(t, []byte{1, 2, 3}, barData)
assert.Nil(t, err)
barReader.Close()

// Make sure we get an error if the file doesn't exist.
_, err = storage.Reader(baz)
bazReader, err := storage.Reader(baz)
assert.NotNil(t, err)
bazReader.Close()

// Also test that CanRead returns the expected results.
fooCanRead, err := storage.CanRead(foo)
Expand Down

0 comments on commit 8aa3299

Please sign in to comment.