Skip to content

Commit

Permalink
test: Add logic to handle for fileHandle.Close() (#10632)
Browse files Browse the repository at this point in the history
Signed-off-by: xin.li <xin.li@daocloud.io>

Signed-off-by: xin.li <xin.li@daocloud.io>
  • Loading branch information
my-git9 committed Sep 22, 2022
1 parent 93aa192 commit 675cbf4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion util/git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ func TestLFSClient(t *testing.T) {
fileHandle, err := os.Open(fmt.Sprintf("%s/test3.yaml", tempDir))
assert.NoError(t, err)
if err == nil {
defer fileHandle.Close()
defer func() {
if err = fileHandle.Close(); err != nil {
assert.NoError(t, err)
}
}()
text, err := io.ReadAll(fileHandle)
assert.NoError(t, err)
if err == nil {
Expand Down

0 comments on commit 675cbf4

Please sign in to comment.