@@ -1082,6 +1082,47 @@ SUITE(Blob)
1082
1082
CHECK (blob.properties ().size () == target_length);
1083
1083
}
1084
1084
1085
+ TEST_FIXTURE (blob_test_base, range_not_satisfiable_exception)
1086
+ {
1087
+ auto blob_name = get_random_string (20 );
1088
+ auto blob = m_container.get_block_blob_reference (blob_name);
1089
+ blob.upload_text (utility::string_t ());
1090
+
1091
+ auto blob2 = m_container.get_block_blob_reference (blob_name + _XPLATSTR (" 2" ));
1092
+ blob2.upload_text (_XPLATSTR (" abcd" ));
1093
+
1094
+ azure::storage::blob_request_options options1;
1095
+ options1.set_parallelism_factor (1 );
1096
+ options1.set_use_transactional_crc64 (false );
1097
+
1098
+ azure::storage::blob_request_options options2;
1099
+ options2.set_parallelism_factor (2 );
1100
+ options2.set_use_transactional_crc64 (false );
1101
+
1102
+ azure::storage::blob_request_options options3;
1103
+ options3.set_parallelism_factor (1 );
1104
+ options3.set_use_transactional_crc64 (true );
1105
+
1106
+ for (const auto & option : { options1, options2, options3 }) {
1107
+ concurrency::streams::container_buffer<std::vector<uint8_t >> download_buffer;
1108
+
1109
+ // download whole blob, no exception
1110
+ blob.download_to_stream (download_buffer.create_ostream (), azure::storage::access_condition (), option, azure::storage::operation_context ());
1111
+
1112
+ // download range, should throw
1113
+ CHECK_THROW (blob.download_range_to_stream (download_buffer.create_ostream (), 0 , 100 , azure::storage::access_condition (), option, azure::storage::operation_context ()), azure::storage::storage_exception);
1114
+
1115
+ // download range(max, ...), no exception
1116
+ blob.download_range_to_stream (download_buffer.create_ostream (), std::numeric_limits<utility::size64_t >::max (), 0 , azure::storage::access_condition (), option, azure::storage::operation_context ());
1117
+
1118
+ // download range(3, very large), no exception
1119
+ blob2.download_range_to_stream (download_buffer.create_ostream (), 3 , 100 , azure::storage::access_condition (), option, azure::storage::operation_context ());
1120
+
1121
+ // download range(4, ...), should throw
1122
+ CHECK_THROW (blob2.download_range_to_stream (download_buffer.create_ostream (), 4 , 100 , azure::storage::access_condition (), option, azure::storage::operation_context ()), azure::storage::storage_exception);
1123
+ }
1124
+ }
1125
+
1085
1126
TEST_FIXTURE (blob_test_base, read_blob_with_invalid_if_none_match)
1086
1127
{
1087
1128
auto blob_name = get_random_string (20 );
0 commit comments