Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Storage Client Library for C++ v2.5.0 #103

Merged
merged 19 commits into from
Nov 21, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update unit test with m_context
  • Loading branch information
JasonYang-MSFT committed Sep 26, 2016
commit 06bbf73da940087f1f362474eca9406e7d2f153b
2 changes: 1 addition & 1 deletion Microsoft.WindowsAzure.Storage/tests/blob_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class blob_test_base : public container_test_base
protected:

bool wait_for_copy(azure::storage::cloud_blob& blob);
static azure::storage::operation_context upload_and_download(azure::storage::cloud_blob& blob, size_t buffer_size, size_t buffer_offset, size_t blob_size, bool use_seekable_stream, const azure::storage::blob_request_options& options, size_t expected_request_count, bool expect_md5_header);
static azure::storage::operation_context upload_and_download(azure::storage::cloud_blob& blob, size_t buffer_size, size_t buffer_offset, size_t blob_size, bool use_seekable_stream, const azure::storage::blob_request_options& options, size_t expected_request_count, bool expect_md5_header, azure::storage::operation_context context);
void check_access(const utility::string_t& sas_token, uint8_t permissions, const azure::storage::cloud_blob_shared_access_headers& headers, const azure::storage::cloud_blob& original_blob);
void check_lease_access(azure::storage::cloud_blob& blob, azure::storage::lease_state state, const utility::string_t& lease_id, bool fake);
static void check_blob_no_stale_property(azure::storage::cloud_blob& blob);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ SUITE(Blob)
const size_t buffer_offsets[2] = { 0, 1024 };
for (auto buffer_offset : buffer_offsets)
{
upload_and_download(m_blob, buffer_size, buffer_offset, 0, true, options, 3, false);
upload_and_download(m_blob, buffer_size, buffer_offset, 0, true, options, 3, false, m_context);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());
}
Expand All @@ -271,7 +271,7 @@ SUITE(Blob)
const size_t buffer_offsets[2] = { 0, 1024 };
for (auto buffer_offset : buffer_offsets)
{
upload_and_download(m_blob, buffer_size, buffer_offset, 0, false, options, 3, false);
upload_and_download(m_blob, buffer_size, buffer_offset, 0, false, options, 3, false, m_context);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());
}
Expand Down Expand Up @@ -511,7 +511,7 @@ SUITE(Blob)
TEST_FIXTURE(append_blob_test_base, append_block_stale_properties)
{
azure::storage::blob_request_options options;
azure::storage::operation_context op;
azure::storage::operation_context op = m_context;

m_blob.create_or_replace(azure::storage::access_condition(), options, m_context);
check_blob_no_stale_property(m_blob);
Expand Down
3 changes: 1 addition & 2 deletions Microsoft.WindowsAzure.Storage/tests/cloud_blob_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ bool blob_test_base::wait_for_copy(azure::storage::cloud_blob& blob)
return blob.copy_state().status() == azure::storage::copy_status::success;
}

azure::storage::operation_context blob_test_base::upload_and_download(azure::storage::cloud_blob& blob, size_t buffer_size, size_t buffer_offset, size_t blob_size, bool use_seekable_stream, const azure::storage::blob_request_options& options, size_t expected_request_count, bool expect_md5_header)
azure::storage::operation_context blob_test_base::upload_and_download(azure::storage::cloud_blob& blob, size_t buffer_size, size_t buffer_offset, size_t blob_size, bool use_seekable_stream, const azure::storage::blob_request_options& options, size_t expected_request_count, bool expect_md5_header, azure::storage::operation_context context)
{
azure::storage::operation_context context;
print_client_request_id(context, _XPLATSTR("upload/download"));

utility::string_t md5_header;
Expand Down
72 changes: 36 additions & 36 deletions Microsoft.WindowsAzure.Storage/tests/cloud_block_blob_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,70 +194,70 @@ SUITE(Blob)
azure::storage::blob_request_options options;

options.set_store_blob_content_md5(false);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_use_transactional_md5(true);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, true), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_single_blob_upload_threshold_in_bytes(4 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, true), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_store_blob_content_md5(false);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_stream_write_size_in_bytes(1 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 7, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 7, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_use_transactional_md5(false);
options.set_single_blob_upload_threshold_in_bytes(6 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(4);
options.set_use_transactional_md5(true);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 7, false), 4);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 7, false, m_context), 4);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(8);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 7, true), 6);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 7, true, m_context), 6);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_store_blob_content_md5(false);
options.set_use_transactional_md5(false);
options.set_parallelism_factor(1);
options.set_http_buffer_size(512 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_stream_write_size_in_bytes(4 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_store_blob_content_md5(true);
options.set_single_blob_upload_threshold_in_bytes(32 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, true), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(4);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, true), 2);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, true, m_context), 2);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

Expand All @@ -266,23 +266,23 @@ SUITE(Blob)
options.set_stream_write_size_in_bytes(1 * 1024 * 1024);
options.set_single_blob_upload_threshold_in_bytes(6 * 1024 * 1024);
options.set_http_buffer_size(0);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_stream_write_size_in_bytes(4 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_store_blob_content_md5(true);
options.set_single_blob_upload_threshold_in_bytes(32 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, true), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 1, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(4);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, true), 2);
check_parallelism(upload_and_download(m_blob, size, 0, 0, true, options, 3, true, m_context), 2);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());
}
Expand All @@ -294,43 +294,43 @@ SUITE(Blob)
options.set_use_transactional_md5(true);

options.set_store_blob_content_md5(false);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, true), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_single_blob_upload_threshold_in_bytes(4 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, true), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_store_blob_content_md5(false);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 3, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_stream_write_size_in_bytes(1 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_single_blob_upload_threshold_in_bytes(6 * 1024 * 1024);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, false), 1);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(4);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, false), 4);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, false, m_context), 4);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(8);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, true), 6);
check_parallelism(upload_and_download(m_blob, size, 0, 0, false, options, 7, true, m_context), 6);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());
}
Expand All @@ -348,26 +348,26 @@ SUITE(Blob)
options.set_use_transactional_md5(false);
options.set_store_blob_content_md5(false);
options.set_parallelism_factor(1);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_use_transactional_md5(true);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 1, true), 1);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 1, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_stream_write_size_in_bytes(1 * 1024 * 1024);
options.set_store_blob_content_md5(false);
options.set_parallelism_factor(4);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 5, false), 4);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 5, false, m_context), 4);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(8);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 5, true), 4);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, true, options, 5, true, m_context), 4);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());
}
Expand All @@ -386,26 +386,26 @@ SUITE(Blob)
options.set_use_transactional_md5(false);
options.set_store_blob_content_md5(false);
options.set_parallelism_factor(1);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 1, false), 1);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 1, false, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_use_transactional_md5(true);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 1, true), 1);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 1, true, m_context), 1);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_stream_write_size_in_bytes(1 * 1024 * 1024);
options.set_store_blob_content_md5(false);
options.set_parallelism_factor(4);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 5, false), 4);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 5, false, m_context), 4);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());

options.set_parallelism_factor(8);
options.set_store_blob_content_md5(true);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 5, true), 4);
check_parallelism(upload_and_download(m_blob, buffer_size, buffer_offset, blob_size, false, options, 5, true, m_context), 4);
m_blob.delete_blob();
m_blob.properties().set_content_md5(utility::string_t());
}
Expand All @@ -416,10 +416,10 @@ SUITE(Blob)
const size_t buffer_size = 2 * 1024 * 1024;
azure::storage::blob_request_options options;
options.set_store_blob_content_md5(false);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 0, buffer_size + 1, true, options, 0, false), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 0, buffer_size + 1, false, options, 0, false), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 1024, buffer_size - 1023, true, options, 0, false), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 1024, buffer_size - 1023, false, options, 0, false), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 0, buffer_size + 1, true, options, 0, false, m_context), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 0, buffer_size + 1, false, options, 0, false, m_context), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 1024, buffer_size - 1023, true, options, 0, false, m_context), std::invalid_argument);
CHECK_THROW(upload_and_download(m_blob, buffer_size, 1024, buffer_size - 1023, false, options, 0, false, m_context), std::invalid_argument);
}

TEST_FIXTURE(block_blob_test_base, block_blob_text_upload)
Expand Down
Loading