Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit 8e3ca89

Browse files
Jinming-Huvinjiang
authored andcommitted
Fix occasionally failed test cases.
For container delete operation, even after REST API returns 202, we cannot expect the container is already deleted, subsequent container delete operations may still get 202.
1 parent f5c0345 commit 8e3ca89

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

Microsoft.WindowsAzure.Storage/tests/blob_lease_test.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,29 @@ void container_test_base::check_lease_access(azure::storage::cloud_blob_containe
6969
if (locked)
7070
{
7171
CHECK_THROW(container.delete_container(empty_condition, azure::storage::blob_request_options(), m_context), azure::storage::storage_exception);
72-
}
73-
else
74-
{
75-
if (allow_delete)
72+
73+
if (fake)
7674
{
77-
container.delete_container(empty_condition, azure::storage::blob_request_options(), m_context);
75+
CHECK_THROW(container.delete_container(lease_condition, azure::storage::blob_request_options(), m_context), azure::storage::storage_exception);
76+
CHECK_THROW(container.download_attributes(lease_condition, azure::storage::blob_request_options(), m_context), azure::storage::storage_exception);
7877
}
79-
}
80-
81-
if (locked && !fake)
82-
{
83-
container.download_attributes(lease_condition, azure::storage::blob_request_options(), m_context);
84-
if (allow_delete)
78+
else
8579
{
86-
container.delete_container(lease_condition, azure::storage::blob_request_options(), m_context);
80+
container.download_attributes(lease_condition, azure::storage::blob_request_options(), m_context);
81+
if (allow_delete)
82+
{
83+
container.delete_container(lease_condition, azure::storage::blob_request_options(), m_context);
84+
}
8785
}
8886
}
8987
else
9088
{
9189
CHECK_THROW(container.delete_container(lease_condition, azure::storage::blob_request_options(), m_context), azure::storage::storage_exception);
9290
CHECK_THROW(container.download_attributes(lease_condition, azure::storage::blob_request_options(), m_context), azure::storage::storage_exception);
91+
if (allow_delete)
92+
{
93+
container.delete_container(empty_condition, azure::storage::blob_request_options(), m_context);
94+
}
9395
}
9496
}
9597

0 commit comments

Comments
 (0)