@@ -298,6 +298,36 @@ func (s *ShareRecordedTestsSuite) TestShareCreateNilMetadata() {
298298 _require .Len (response .Metadata , 0 )
299299}
300300
301+ func (s * ShareRecordedTestsSuite ) TestShareSizeLimitReached () {
302+ _require := require .New (s .T ())
303+ testName := s .T ().Name ()
304+
305+ svcClient , err := testcommon .GetServiceClient (s .T (), testcommon .TestAccountDefault , nil )
306+ _require .NoError (err )
307+
308+ shareName := testcommon .GenerateShareName (testName )
309+ shareClient := svcClient .NewShareClient (shareName )
310+
311+ quotaInGB := int32 (1 ) // Set a 1 GB quota
312+ _ , err = shareClient .Create (context .Background (), & service.CreateShareOptions {
313+ Quota : & quotaInGB ,
314+ })
315+ defer testcommon .DeleteShare (context .Background (), _require , shareClient )
316+ _require .NoError (err )
317+
318+ // Attempt to exceed the share's quota
319+ dirClient := shareClient .NewDirectoryClient ("testdir" )
320+ _ , err = dirClient .Create (context .Background (), nil )
321+ _require .NoError (err )
322+
323+ fileClient := dirClient .NewFileClient ("largefile" )
324+ fileSize := int64 (2 * 1024 * 1024 * 1024 ) // 2 GB file to exceed 1 GB quota
325+ _ , err = fileClient .Create (context .Background (), fileSize , nil )
326+ _require .Error (err )
327+
328+ testcommon .ValidateFileErrorCode (_require , err , fileerror .ShareSizeLimitReached )
329+ }
330+
301331func (s * ShareRecordedTestsSuite ) TestShareCreateWithSnapshotVirtualDirectoryAccess () {
302332 _require := require .New (s .T ())
303333 testName := s .T ().Name ()
0 commit comments