Azurite: XStore C++ tests are failing because Azurite returns wrong md5
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
3.30.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
npm
What’s the Node.js version?
v20.10.0
What problem was encountered?
My team in XStore is trying to migrate tests from Storage Emulator to Azurite. We are blocked by failures that occur only when using Azurite.
The following code is a simplified example of the problem. It works against a real storage account and Storage Emulator.
With Azurite, it throws a storage_exception indicating Calculated MD5 does not match existing property.
Steps to reproduce the issue?
void Sample(
const std::string& accountName,
const std::string& accountKey,
const std::string& blobUrl)
{
storage_credentials credentials(
to_string_t(accountName),
to_string_t(accountKey));
auto blob = cloud_block_blob(
storage_uri(web::http::uri(to_string_t(blobUrl))),
credentials);
const auto& client = blob.service_client();
auto context = operation_context();
auto options = blob_request_options();
options.set_retry_policy(no_retry_policy());
auto conditions = access_condition::generate_empty_condition();
auto container = client.get_container_reference(blob.container().name());
container.create_if_not_exists(
blob_container_public_access_type::off,
options,
context);
// Create an empty blob
std::vector<BYTE> emptyContent;
blob.upload_from_stream(
Concurrency::streams::rawptr_stream<BYTE>::open_istream(
emptyContent.data(),
emptyContent.size()),
access_condition::generate_if_not_exists_condition(),
options,
context);
// Write some data to the blob
utility::string_t blockId = L"Zm9v";
blob.upload_block(
blockId,
Concurrency::streams::rawptr_stream<BYTE>::open_istream(
(const BYTE*)"abc",
3),
checksum_none,
conditions,
options,
context);
blob.upload_block_list(
{blockId},
conditions,
options,
context);
// Read the data back
BYTE buffer[10]{};
blob.download_range_to_stream(
Concurrency::streams::rawptr_stream<BYTE>::open_ostream(buffer, 10),
0,
6,
conditions,
options,
context);
VERIFY_ARE_EQUAL('a', buffer[0]);
VERIFY_ARE_EQUAL('b', buffer[1]);
VERIFY_ARE_EQUAL('c', buffer[2]);
}
If possible, please provide the debug log
Have you found a mitigation/solution?
No
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (13 by maintainers)
@mikamins , @Jinming-Hu
Thanks for the investigation! I will look into it and update later.
@blueww This seems to be a bug in Azurite. Azurite doesn’t clear all blob properties when it’s overwritten.