|
3 | 3 |
|
4 | 4 | package com.azure.storage.file.share.specialized |
5 | 5 |
|
| 6 | +import com.azure.core.http.rest.Response |
6 | 7 | import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion |
7 | 8 | import com.azure.storage.file.share.APISpec |
8 | 9 | import com.azure.storage.file.share.ShareClient |
9 | 10 | import com.azure.storage.file.share.ShareFileClient |
10 | 11 | import com.azure.storage.file.share.ShareServiceVersion |
11 | 12 | import com.azure.storage.file.share.models.LeaseDurationType |
12 | 13 | import com.azure.storage.file.share.models.LeaseStateType |
| 14 | +import com.azure.storage.file.share.models.ShareErrorCode |
13 | 15 | import com.azure.storage.file.share.models.ShareStorageException |
14 | 16 | import com.azure.storage.file.share.options.ShareAcquireLeaseOptions |
15 | 17 | import com.azure.storage.file.share.options.ShareBreakLeaseOptions |
@@ -203,9 +205,13 @@ class LeaseAPITest extends APISpec { |
203 | 205 | setup: |
204 | 206 | def shareSnapshot = shareClient.createSnapshot().getSnapshot() |
205 | 207 | def shareClient = shareBuilderHelper(shareClient.getShareName(), shareSnapshot).buildClient() |
| 208 | + def leaseClient = createLeaseClient(shareClient) |
206 | 209 |
|
207 | 210 | when: |
208 | | - def resp = createLeaseClient(shareClient).acquireLeaseWithResponse(new ShareAcquireLeaseOptions().setDuration(-1), null, null) |
| 211 | + def resp = retry({ |
| 212 | + leaseClient |
| 213 | + .acquireLeaseWithResponse(new ShareAcquireLeaseOptions().setDuration(-1), null, null) |
| 214 | + },{ShareStorageException it -> it.errorCode == ShareErrorCode.SHARE_SNAPSHOT_IN_PROGRESS}) |
209 | 215 |
|
210 | 216 | then: |
211 | 217 | resp.getStatusCode() == 201 |
|
0 commit comments