Skip to content

Commit

Permalink
High Throughput Append Blob (#21424)
Browse files Browse the repository at this point in the history
* adding test for highthroughput appendblob

* recorded test

* Unrecord file, update CHANGELOG.md
  • Loading branch information
siminsavani-msft committed Aug 28, 2023
1 parent 7dd9abf commit 66a9d3d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions sdk/storage/azblob/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Added [FilterBlobs by Tags](https://learn.microsoft.com/rest/api/storageservices/find-blobs-by-tags-container) API for container client.
* Added `System` option to `ListContainersInclude` to allow listing of system containers (i.e, $web).
* Updated the SAS Version to `2021-12-02` and added `Encryption Scope` to Account SAS, Service SAS, and User Delegation SAS
* Content length limit for `AppendBlob.AppendBlock()` and `AppendBlob.AppendBlockFromURL()` raised from 4 MB to 100 MB.

### Breaking Changes

Expand Down
30 changes: 30 additions & 0 deletions sdk/storage/azblob/appendblob/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,36 @@ func (s *AppendBlobRecordedTestsSuite) TestAppendBlock() {
_require.Equal(*appendResp.BlobCommittedBlockCount, int32(2))
}

func (s *AppendBlobUnrecordedTestsSuite) TestAppendBlockHighThroughput() {
_require := require.New(s.T())
testName := s.T().Name()
svcClient, err := testcommon.GetServiceClient(s.T(), testcommon.TestAccountDefault, nil)
_require.NoError(err)

containerName := testcommon.GenerateContainerName(testName)
containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient)
defer testcommon.DeleteContainer(context.Background(), _require, containerClient)

abName := testcommon.GenerateBlobName(testName)
abClient := containerClient.NewAppendBlobClient(testcommon.GenerateBlobName(abName))

// Create AppendBlob with 5MB data
_, err = abClient.Create(context.Background(), nil)
_require.Nil(err)
contentSize := 5 * 1024 * 1024 // 5MB
r, sourceData := testcommon.GetDataAndReader(testName, contentSize)
appendResp, err := abClient.AppendBlock(context.Background(), streaming.NopCloser(r), nil)
_require.Nil(err)
_require.NotNil(appendResp.ETag)

// Check data integrity through downloading.
destBuffer := make([]byte, contentSize)
downloadBufferOptions := blob.DownloadBufferOptions{Range: blob.HTTPRange{Offset: 0, Count: int64(contentSize)}}
_, err = abClient.DownloadBuffer(context.Background(), destBuffer, &downloadBufferOptions)
_require.Nil(err)
_require.Equal(destBuffer, sourceData)
}

func (s *AppendBlobUnrecordedTestsSuite) TestAppendBlockWithAutoGeneratedCRC64() {
_require := require.New(s.T())
testName := s.T().Name()
Expand Down

0 comments on commit 66a9d3d

Please sign in to comment.