Skip to content

Commit

Permalink
Append With Flush from PR #22245
Browse files Browse the repository at this point in the history
  • Loading branch information
tanyasethi-msft committed Mar 18, 2024
1 parent e2681a3 commit 66a8557
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
4 changes: 0 additions & 4 deletions sdk/storage/azdatalake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
* Updated version of azblob to `1.3.0`
* Updated azcore version to `1.9.2` and azidentity version to `1.5.1`.

=======
>>>>>>> 63ae0d232b ([azdatalake] HNS encryption scope (#22346))
=======
>>>>>>> 63ae0d232b ([azdatalake] HNS encryption scope (#22346))
## 1.1.0-beta.1 (2024-01-10)

### Features Added
Expand Down
34 changes: 34 additions & 0 deletions sdk/storage/azdatalake/file/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3654,6 +3654,40 @@ func (s *RecordedTestSuite) TestFileAppendWithFlushReleaseLease() {
_require.Equal(lease.StateTypeAvailable, *gResp2.LeaseState)
}

func (s *RecordedTestSuite) TestFileAppendWithFlushOption() {
_require := require.New(s.T())
testName := s.T().Name()

filesystemName := testcommon.GenerateFileSystemName(testName)
fsClient, err := testcommon.GetFileSystemClient(filesystemName, s.T(), testcommon.TestAccountDatalake, nil)
_require.NoError(err)
defer testcommon.DeleteFileSystem(context.Background(), _require, fsClient)

_, err = fsClient.Create(context.Background(), nil)
_require.NoError(err)

srcFileName := "src" + testcommon.GenerateFileName(testName)

srcFClient, err := testcommon.GetFileClient(filesystemName, srcFileName, s.T(), testcommon.TestAccountDatalake, nil)
_require.NoError(err)

resp, err := srcFClient.Create(context.Background(), nil)
_require.NoError(err)
_require.NotNil(resp)

contentSize := 1024 * 8 // 8KB
rsc, _ := testcommon.GenerateData(contentSize)
opts := &file.AppendDataOptions{
Flush: to.Ptr(true),
}
_, err = srcFClient.AppendData(context.Background(), 0, rsc, opts)
_require.NoError(err)

gResp2, err := srcFClient.GetProperties(context.Background(), nil)
_require.NoError(err)
_require.Equal(*gResp2.ContentLength, int64(contentSize))
}

func (s *RecordedTestSuite) TestFileAppendAndFlushData() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down
2 changes: 2 additions & 0 deletions sdk/storage/azdatalake/file/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ type AppendDataOptions struct {
ProposedLeaseID *string
// CPKInfo contains optional parameters to perform encryption using customer-provided key.
CPKInfo *CPKInfo
//Flush Optional. If true, the file will be flushed after append.
Flush *bool
}

func (o *AppendDataOptions) format(offset int64, body io.ReadSeekCloser) (*generated.PathClientAppendDataOptions,
Expand Down

0 comments on commit 66a8557

Please sign in to comment.