@@ -594,6 +594,63 @@ end # @testitem
594
594
return nrequests[]
595
595
end
596
596
597
+ function test_invalid_block_list ()
598
+ nrequests = Ref (0 )
599
+ uploadid = nothing
600
+ (port, tcp_server) = Sockets. listenany (8081 )
601
+ http_server = HTTP. serve! (tcp_server) do request:: HTTP.Request
602
+ nrequests[] += 1
603
+ if request. method == " PUT"
604
+ if occursin (" comp=blocklist" , request. target)
605
+ uploadid_value = HTTP. header (request, " x-ms-meta-uploadid" )
606
+ if ! isnothing (uploadid_value)
607
+ uploadid = " x-ms-meta-uploadid" => uploadid_value
608
+ end
609
+ return HTTP. Response (400 , " InvalidBlockList" )
610
+ else
611
+ return HTTP. Response (200 , [
612
+ " Content-Length" => " 0" ,
613
+ " Last-Modified" => " Tue, 15 Oct 2019 12:45:26 GMT" ,
614
+ " ETag" => " 123"
615
+ ], " " )
616
+ end
617
+ elseif request. method == " HEAD"
618
+ return HTTP. Response (200 , [
619
+ uploadid,
620
+ " Content-Length" => " 0" ,
621
+ " Last-Modified" => " Tue, 15 Oct 2019 12:45:26 GMT" ,
622
+ " ETag" => " 123"
623
+ ], " " )
624
+ else
625
+ return HTTP. Response (404 , " Not Found" )
626
+ end
627
+ end
628
+
629
+ baseurl = " http://127.0.0.1:$port /$account /$container /"
630
+ conf = AzureConfig (;
631
+ storage_account_name= account,
632
+ container_name= container,
633
+ storage_account_key= shared_key_from_azurite,
634
+ host= baseurl,
635
+ opts= ClientOptions (;
636
+ max_retries= max_retries,
637
+ retry_timeout_secs= retry_timeout_secs,
638
+ request_timeout_secs
639
+ )
640
+ )
641
+
642
+ try
643
+ put_object (zeros (UInt8, 11 * 1024 * 1024 ), " blob" , conf)
644
+ @test true
645
+ catch e
646
+ @test false
647
+ finally
648
+ Threads. @spawn HTTP. forceclose (http_server)
649
+ end
650
+ # wait(http_server)
651
+ return nrequests[]
652
+ end
653
+
597
654
@testset " 400: Bad Request" begin
598
655
# Returned when there's an error in the request URI, headers, or body. The response body
599
656
# contains an error message explaining what the specific problem is.
@@ -762,4 +819,9 @@ end # @testitem
762
819
nrequests = test_cancellation ()
763
820
@test nrequests == 1
764
821
end
822
+
823
+ @testset " InvalidBlockList" begin
824
+ nrequests = test_invalid_block_list ()
825
+ @test nrequests == 4
826
+ end
765
827
end
0 commit comments