From 9e3eeaa8c791808e312603d9238d5f545992e5a8 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Tue, 11 Aug 2020 15:01:37 -0700 Subject: [PATCH 1/7] added venv to gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d357979f797d..41a2c9cf82f7 100644 --- a/.gitignore +++ b/.gitignore @@ -84,7 +84,7 @@ src/build # [begoldsm] ignore virtual env if it exists. adlEnv/ - +venv/ code_reports # Azure Storage test credentials From a5ad618bdc2d1f80ea7b5679d83a71812417abdb Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Wed, 12 Aug 2020 09:12:24 -0700 Subject: [PATCH 2/7] fixed etag bug --- sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py index 092aadc7102c..7d384233c221 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py @@ -129,7 +129,7 @@ def acquire(self, lease_duration=-1, **kwargs): process_storage_error(error) self.id = response.get('lease_id') # type: str self.last_modified = response.get('last_modified') # type: datetime - self.etag = kwargs.get('etag') # type: str + self.etag = response.get('etag') # type: str @distributed_trace def renew(self, **kwargs): From 4778016c7c19abd4a9a26b48545d0924e5f613e7 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Wed, 12 Aug 2020 15:41:42 -0700 Subject: [PATCH 3/7] added unit tests for etag bug --- .../azure-storage-blob/tests/test_blob_access_conditions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py index 39d0cda15fde..e8be33e22a54 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py @@ -1439,7 +1439,6 @@ def test_lease_blob_with_if_match(self, resource_group, location, storage_accoun blob = bsc.get_blob_client(self.container_name, 'blob1') etag = blob.get_blob_properties().etag test_lease_id = '00000000-1111-2222-3333-444444444444' - # Act lease = blob.acquire_lease( lease_id=test_lease_id, @@ -1450,6 +1449,8 @@ def test_lease_blob_with_if_match(self, resource_group, location, storage_accoun # Assert self.assertIsInstance(lease, BlobLeaseClient) self.assertIsNotNone(lease.id) + self.assertIsNotNone(lease.etag) + self.assertEqual(lease.etag, etag) @GlobalStorageAccountPreparer() def test_lease_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): From 3ee29c638cdb53cb048da67153ca6c08eb6ba2e1 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Wed, 12 Aug 2020 15:46:00 -0700 Subject: [PATCH 4/7] added spacing --- .../azure-storage-blob/tests/test_blob_access_conditions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py index e8be33e22a54..876c8bb55849 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py @@ -1439,6 +1439,7 @@ def test_lease_blob_with_if_match(self, resource_group, location, storage_accoun blob = bsc.get_blob_client(self.container_name, 'blob1') etag = blob.get_blob_properties().etag test_lease_id = '00000000-1111-2222-3333-444444444444' + # Act lease = blob.acquire_lease( lease_id=test_lease_id, From b9b1856b835df23254a204917c30d815799c2995 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Wed, 12 Aug 2020 15:54:11 -0700 Subject: [PATCH 5/7] added myself as codeowner --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 09bbe2f736b9..1bc35694835e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -23,7 +23,7 @@ /sdk/eventhub/ @annatisch @yunhaoling @YijunXieMS # PRLabel: %Storage -/sdk/storage/ @amishra-dev @zezha-msft @annatisch @rakshith91 @xiafu-msft @kasobol-msft +/sdk/storage/ @amishra-dev @zezha-msft @annatisch @rakshith91 @xiafu-msft @tasherif-msft @kasobol-msft /sdk/applicationinsights/ @alexeldeib From fa8f27d156fc12d7a13eeafbfbe3c1812e6f88d5 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Wed, 12 Aug 2020 16:06:59 -0700 Subject: [PATCH 6/7] fixed etag bug in async lease --- .../azure-storage-blob/azure/storage/blob/aio/_lease_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py index 6fb5f18e1e7b..5f68a9b7b874 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py @@ -115,7 +115,7 @@ async def acquire(self, lease_duration=-1, **kwargs): process_storage_error(error) self.id = response.get('lease_id') # type: str self.last_modified = response.get('last_modified') # type: datetime - self.etag = kwargs.get('etag') # type: str + self.etag = response.get('etag') # type: str @distributed_trace_async async def renew(self, **kwargs): From 1f6be663900900e4cfceb34e11d2002a8769c6ad Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Wed, 12 Aug 2020 16:11:51 -0700 Subject: [PATCH 7/7] added async test --- .../tests/test_blob_access_conditions_async.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py index 0b36e10a3a89..c7cb1af7b692 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py @@ -1542,6 +1542,8 @@ async def test_lease_blob_with_if_match(self, resource_group, location, storage_ # Assert self.assertIsInstance(lease, BlobLeaseClient) self.assertIsNotNone(lease.id) + self.assertIsNotNone(lease.etag) + self.assertEqual(lease.etag, etag) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test