Skip to content

Commit 15d9064

Browse files
[Storage] Fixed live tests relating to File Share (Azure#47558)
1 parent dd82e75 commit 15d9064

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

sdk/storage/azure-storage-file-share/tests/test_share.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,11 +814,11 @@ def test_list_shares_leased_share(self, **kwargs):
814814

815815
# Act
816816
lease = share.acquire_lease(lease_id="00000000-1111-2222-3333-444444444444")
817-
resp = list(self.fsc.list_shares())
817+
resp = [s for s in list(self.fsc.list_shares()) if s.name == share.share_name]
818818

819819
# Assert
820820
assert resp is not None
821-
assert len(resp) >= 1
821+
assert len(resp) == 1
822822
assert resp[0] is not None
823823
assert resp[0].lease.duration == "infinite"
824824
assert resp[0].lease.status == "locked"
@@ -935,8 +935,6 @@ def test_list_shares_with_num_results_and_marker(self, **kwargs):
935935
for i in range(0, 4):
936936
share_names.append(self._create_share(prefix + str(i)).share_name)
937937

938-
# share_names.sort()
939-
940938
# Act
941939
generator1 = self.fsc.list_shares(prefix, results_per_page=2).by_page()
942940
shares1 = list(next(generator1))

sdk/storage/azure-storage-file-share/tests/test_share_async.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,11 +816,12 @@ async def test_list_shares_leased_share(self, **kwargs):
816816
lease = await share.acquire_lease(lease_id="00000000-1111-2222-3333-444444444444")
817817
resp = []
818818
async for s in self.fsc.list_shares():
819-
resp.append(s)
819+
if s.name == share.share_name:
820+
resp.append(s)
820821

821822
# Assert
822823
assert resp is not None
823-
assert len(resp) >= 1
824+
assert len(resp) == 1
824825
assert resp[0] is not None
825826
assert resp[0].lease.duration == "infinite"
826827
assert resp[0].lease.status == "locked"
@@ -944,8 +945,6 @@ async def test_list_shares_with_num_results_and_marker(self, **kwargs):
944945
share = await self._create_share(prefix + str(i))
945946
share_names.append(share.share_name)
946947

947-
share_names.sort()
948-
949948
# Act
950949
generator1 = self.fsc.list_shares(prefix, results_per_page=2).by_page()
951950
shares1 = []

0 commit comments

Comments
 (0)