@@ -3433,7 +3433,7 @@ func (s *BlockBlobUnrecordedTestsSuite) TestUploadStreamToBlobProperties() {
34333433 // Perform UploadStream
34343434 _ , err = bbClient .UploadStream (context .Background (), blobContentReader ,
34353435 & blockblob.UploadStreamOptions {
3436- BlockSize : bufferSize ,
3436+ BlockSize : int64 ( bufferSize ) ,
34373437 Concurrency : maxBuffers ,
34383438 Metadata : testcommon .BasicMetadata ,
34393439 Tags : testcommon .BasicBlobTagsMap ,
@@ -3748,3 +3748,98 @@ func (s *BlockBlobUnrecordedTestsSuite) TestBlockBlobSetExpiryToPast() {
37483748 _require .Nil (err )
37493749 _require .Nil (resp .ExpiresOn )
37503750}
3751+
3752+ func (s * BlockBlobUnrecordedTestsSuite ) TestLargeBlockBlobStage () {
3753+ _require := require .New (s .T ())
3754+ testName := s .T ().Name ()
3755+ svcClient , err := testcommon .GetServiceClient (s .T (), testcommon .TestAccountDefault , nil )
3756+ _require .NoError (err )
3757+
3758+ containerName := testcommon .GenerateContainerName (testName )
3759+ containerClient := testcommon .CreateNewContainer (context .Background (), _require , containerName , svcClient )
3760+ defer testcommon .DeleteContainer (context .Background (), _require , containerClient )
3761+
3762+ bbClient := testcommon .GetBlockBlobClient (testcommon .GenerateBlobName (testName ), containerClient )
3763+
3764+ var largeBlockSize int64 = blockblob .MaxStageBlockBytes
3765+ content := make ([]byte , largeBlockSize )
3766+ body := bytes .NewReader (content )
3767+ rsc := streaming .NopCloser (body )
3768+
3769+ blockID := base64 .StdEncoding .EncodeToString ([]byte (fmt .Sprintf ("%6d" , 0 )))
3770+ _ , err = bbClient .StageBlock (context .Background (), blockID , rsc , nil )
3771+ _require .Nil (err )
3772+
3773+ _ , err = bbClient .CommitBlockList (context .Background (), []string {blockID }, nil )
3774+ _require .Nil (err )
3775+
3776+ resp , err := bbClient .GetBlockList (context .Background (), blockblob .BlockListTypeAll , nil )
3777+ _require .Nil (err )
3778+ _require .Len (resp .BlockList .CommittedBlocks , 1 )
3779+ committed := resp .BlockList .CommittedBlocks
3780+ _require .Equal (* (committed [0 ].Name ), blockID )
3781+ _require .Equal (* (committed [0 ].Size ), largeBlockSize )
3782+ _require .Nil (resp .BlockList .UncommittedBlocks )
3783+ }
3784+
3785+ func (s * BlockBlobUnrecordedTestsSuite ) TestLargeBlockStreamUploadWithDifferentBlockSize () {
3786+ _require := require .New (s .T ())
3787+ testName := s .T ().Name ()
3788+ svcClient , err := testcommon .GetServiceClient (s .T (), testcommon .TestAccountDefault , nil )
3789+ _require .NoError (err )
3790+
3791+ containerName := testcommon .GenerateContainerName (testName )
3792+ containerClient := testcommon .CreateNewContainer (context .Background (), _require , containerName , svcClient )
3793+ defer testcommon .DeleteContainer (context .Background (), _require , containerClient )
3794+
3795+ bbClient := testcommon .GetBlockBlobClient (testcommon .GenerateBlobName (testName ), containerClient )
3796+
3797+ var firstBlockSize , secondBlockSize int64 = 2500 * 1024 * 1024 , 10 * 1024 * 1024
3798+ content := make ([]byte , firstBlockSize + secondBlockSize )
3799+ body := bytes .NewReader (content )
3800+ rsc := streaming .NopCloser (body )
3801+
3802+ _ , err = bbClient .UploadStream (context .Background (), rsc , & blockblob.UploadStreamOptions {
3803+ BlockSize : firstBlockSize ,
3804+ Concurrency : 2 ,
3805+ })
3806+ _require .Nil (err )
3807+
3808+ resp , err := bbClient .GetBlockList (context .Background (), blockblob .BlockListTypeAll , nil )
3809+ _require .Nil (err )
3810+ _require .Len (resp .BlockList .CommittedBlocks , 2 )
3811+ _require .Equal (* resp .BlobContentLength , firstBlockSize + secondBlockSize )
3812+ committed := resp .BlockList .CommittedBlocks
3813+ _require .Equal (* (committed [0 ].Size ), firstBlockSize )
3814+ _require .Equal (* (committed [1 ].Size ), secondBlockSize )
3815+ }
3816+
3817+ func (s * BlockBlobUnrecordedTestsSuite ) TestLargeBlockBufferedUploadInParallel () {
3818+ _require := require .New (s .T ())
3819+ testName := s .T ().Name ()
3820+ svcClient , err := testcommon .GetServiceClient (s .T (), testcommon .TestAccountDefault , nil )
3821+ _require .NoError (err )
3822+
3823+ containerName := testcommon .GenerateContainerName (testName )
3824+ containerClient := testcommon .CreateNewContainer (context .Background (), _require , containerName , svcClient )
3825+ defer testcommon .DeleteContainer (context .Background (), _require , containerClient )
3826+
3827+ bbClient := testcommon .GetBlockBlobClient (testcommon .GenerateBlobName (testName ), containerClient )
3828+
3829+ var largeBlockSize , numberOfBlocks int64 = 2500 * 1024 * 1024 , 2
3830+ content := make ([]byte , numberOfBlocks * largeBlockSize )
3831+
3832+ _ , err = bbClient .UploadBuffer (context .Background (), content , & blockblob.UploadBufferOptions {
3833+ BlockSize : largeBlockSize ,
3834+ Concurrency : 2 ,
3835+ })
3836+ _require .Nil (err )
3837+
3838+ resp , err := bbClient .GetBlockList (context .Background (), blockblob .BlockListTypeAll , nil )
3839+ _require .Nil (err )
3840+ _require .Len (resp .BlockList .CommittedBlocks , 2 )
3841+ _require .Equal (* resp .BlobContentLength , numberOfBlocks * largeBlockSize )
3842+ committed := resp .BlockList .CommittedBlocks
3843+ _require .Equal (* (committed [0 ].Size ), largeBlockSize )
3844+ _require .Equal (* (committed [1 ].Size ), largeBlockSize )
3845+ }
0 commit comments