Skip to content

Commit

Permalink
Fixed etag bug (#13078)
Browse files Browse the repository at this point in the history
* added venv to gitignore

* fixed etag bug

* added unit tests for etag bug

* added spacing

* added myself as codeowner

* fixed etag bug in async lease

* added async test
  • Loading branch information
tasherif-msft authored Aug 13, 2020
1 parent c84a0b5 commit 84fb33e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ src/build

# [begoldsm] ignore virtual env if it exists.
adlEnv/

venv/
code_reports

# Azure Storage test credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 84fb33e

Please sign in to comment.