Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.azure.storage.file.share.models.LeaseStateType
import com.azure.storage.file.share.models.ShareStorageException
import com.azure.storage.file.share.options.ShareAcquireLeaseOptions
import com.azure.storage.file.share.options.ShareBreakLeaseOptions
import spock.lang.Requires
import spock.lang.Unroll

import java.time.Duration
Expand Down Expand Up @@ -159,6 +160,7 @@ class LeaseAPITest extends APISpec {
}

@Unroll
@Requires( { playbackMode() } )
def "Acquire share lease"() {
setup:
def leaseResponse = createLeaseClient(shareClient, proposedID).acquireLeaseWithResponse(new ShareAcquireLeaseOptions().setDuration(leaseTime), null, null)
Expand All @@ -179,11 +181,13 @@ class LeaseAPITest extends APISpec {
UUID.randomUUID().toString() | -1 || LeaseStateType.LEASED | LeaseDurationType.INFINITE
}

@Requires( { playbackMode() } )
def "Acquire share lease min"() {
expect:
createLeaseClient(shareClient).acquireLeaseWithResponse(null, null, null).getStatusCode() == 201
}

@Requires( { playbackMode() } )
def "Acquire share lease snapshot"() {
setup:
def shareSnapshot = shareClient.createSnapshot().getSnapshot()
Expand All @@ -197,6 +201,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, resp.getValue()).releaseLeaseWithResponse(null, null)
}

@Requires( { playbackMode() } )
def "Acquire share lease snapshot fail"() {
setup:
def shareSnapshot = "2020-08-19T19:26:08.0000000Z"
Expand All @@ -210,6 +215,7 @@ class LeaseAPITest extends APISpec {
}

@Unroll
@Requires( { playbackMode() } )
def "Acquire share lease duration fail"() {
setup:
def leaseClient = createLeaseClient(shareClient)
Expand All @@ -227,6 +233,7 @@ class LeaseAPITest extends APISpec {
70 | _
}

@Requires( { playbackMode() } )
def "Acquire share lease error"() {
setup:
shareClient = shareBuilderHelper(interceptorManager, generateShareName()).buildClient()
Expand All @@ -238,6 +245,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Renew share lease"() {
setup:
def leaseID = setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -251,6 +259,7 @@ class LeaseAPITest extends APISpec {
validateBasicHeaders(renewLeaseResponse.getHeaders())
}

@Requires( { playbackMode() } )
def "Renew share lease min"() {
setup:
def leaseID = setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -259,6 +268,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, leaseID).renewLeaseWithResponse(null, null).getStatusCode() == 200
}

@Requires( { playbackMode() } )
def "Renew share lease snapshot"() {
setup:
def shareSnapshot = shareClient.createSnapshot().getSnapshot()
Expand All @@ -273,6 +283,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, resp.getValue()).releaseLeaseWithResponse(null, null)
}

@Requires( { playbackMode() } )
def "Renew share lease snapshot fail"() {
setup:
def shareSnapshot = "2020-08-19T19:26:08.0000000Z"
Expand All @@ -285,6 +296,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Renew share lease error"() {
setup:
shareClient = shareBuilderHelper(interceptorManager, generateShareName()).buildClient()
Expand All @@ -296,6 +308,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Release share lease"() {
setup:
def leaseID = setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -307,6 +320,7 @@ class LeaseAPITest extends APISpec {
validateBasicHeaders(releaseLeaseResponse.getHeaders())
}

@Requires( { playbackMode() } )
def "Release share lease min"() {
setup:
def leaseID = setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -315,6 +329,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, leaseID).releaseLeaseWithResponse(null, null).getStatusCode() == 200
}

@Requires( { playbackMode() } )
def "Release share lease snapshot"() {
setup:
def shareSnapshot = shareClient.createSnapshot().getSnapshot()
Expand All @@ -325,6 +340,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, leaseID).releaseLeaseWithResponse(null, null).getStatusCode() == 200
}

@Requires( { playbackMode() } )
def "Release share lease snapshot fail"() {
setup:
def shareSnapshot = "2020-08-19T19:26:08.0000000Z"
Expand All @@ -337,6 +353,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Release share lease error"() {
setup:
shareClient = shareBuilderHelper(interceptorManager, generateShareName()).buildClient()
Expand All @@ -349,6 +366,7 @@ class LeaseAPITest extends APISpec {
}

@Unroll
@Requires( { playbackMode() } )
def "Break share lease"() {
setup:
def leaseClient = createLeaseClient(shareClient, getRandomUUID())
Expand All @@ -374,6 +392,7 @@ class LeaseAPITest extends APISpec {

}

@Requires( { playbackMode() } )
def "Break share lease min"() {
setup:
setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -382,6 +401,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient).breakLeaseWithResponse(new ShareBreakLeaseOptions(), null, null).getStatusCode() == 202
}

@Requires( { playbackMode() } )
def "Break share lease snapshot"() {
setup:
def shareSnapshot = shareClient.createSnapshot().getSnapshot()
Expand All @@ -396,6 +416,7 @@ class LeaseAPITest extends APISpec {

}

@Requires( { playbackMode() } )
def "Break share lease snapshot fail"() {
setup:
def shareSnapshot = "2020-08-19T19:26:08.0000000Z"
Expand All @@ -408,6 +429,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Break share lease error"() {
setup:
shareClient = shareBuilderHelper(interceptorManager, generateShareName()).buildClient()
Expand All @@ -419,6 +441,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Change share lease"() {
setup:
def leaseID = setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -431,6 +454,7 @@ class LeaseAPITest extends APISpec {
validateBasicHeaders(changeLeaseResponse.getHeaders())
}

@Requires( { playbackMode() } )
def "Change share lease min"() {
setup:
def leaseID = setupShareLeaseCondition(shareClient, receivedLeaseID)
Expand All @@ -439,6 +463,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, leaseID).changeLeaseWithResponse(getRandomUUID(), null, null).getStatusCode() == 200
}

@Requires( { playbackMode() } )
def "Change share lease snapshot"() {
setup:
def shareSnapshot = shareClient.createSnapshot().getSnapshot()
Expand All @@ -453,6 +478,7 @@ class LeaseAPITest extends APISpec {
createLeaseClient(shareClient, resp.getValue()).releaseLeaseWithResponse(null, null)
}

@Requires( { playbackMode() } )
def "Change share lease snapshot fail"() {
setup:
def shareSnapshot = "2020-08-19T19:26:08.0000000Z"
Expand All @@ -465,6 +491,7 @@ class LeaseAPITest extends APISpec {
thrown(ShareStorageException)
}

@Requires( { playbackMode() } )
def "Change share lease error"() {
setup:
shareClient = shareBuilderHelper(interceptorManager, generateShareName()).buildClient()
Expand Down