Skip to content

Commit

Permalink
Use O_CREAT flag when testing creation with OpenFile.
Browse files Browse the repository at this point in the history
  • Loading branch information
foodprocessor committed Jan 1, 2025
1 parent 730c271 commit 80fee42
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions component/file_cache/file_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,9 @@ func (suite *fileCacheTestSuite) TestOpenCreateGetAttr() {
// we report file does not exist before it is created
attr, err := suite.fileCache.GetAttr(internal.GetAttrOptions{Name: path})
suite.assert.Nil(attr)
suite.assert.Error(err)
suite.assert.ErrorIs(err, os.ErrNotExist)
// since it does not exist, we allow the file to be created using OpenFile
handle, err := suite.fileCache.OpenFile(internal.OpenFileOptions{Name: path, Mode: 0777})
handle, err := suite.fileCache.OpenFile(internal.OpenFileOptions{Name: path, Flags: os.O_CREATE, Mode: 0777})
suite.assert.NoError(err)
suite.assert.EqualValues(path, handle.Path)
// we should report that the file exists now
Expand Down

0 comments on commit 80fee42

Please sign in to comment.