From 0424300e32e3a797af7aa1c2158f3bf245623c9d Mon Sep 17 00:00:00 2001 From: Kamil Sobol <61715331+kasobol-msft@users.noreply.github.com> Date: Wed, 22 Sep 2021 10:14:48 -0700 Subject: [PATCH] [Storage] Unflaky more RBAC dependent tests (#24261) * transform composite blob exception to datalake model. * cl. * ... * retry tests that rely on RBAC replication. --- .../com/azure/storage/blob/OAuthCopySourceTests.groovy | 10 ++++++++++ .../storage/file/share/OAuthCopySourceTests.groovy | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/OAuthCopySourceTests.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/OAuthCopySourceTests.groovy index 61e2f4c29e6ff..960b24861799b 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/OAuthCopySourceTests.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/OAuthCopySourceTests.groovy @@ -1,6 +1,7 @@ package com.azure.storage.blob import com.azure.core.http.HttpAuthorization +import com.azure.core.test.TestMode import com.azure.core.util.BinaryData import com.azure.core.util.Context import com.azure.storage.blob.models.BlobStorageException @@ -13,6 +14,7 @@ import com.azure.storage.blob.specialized.AppendBlobClient import com.azure.storage.blob.specialized.BlockBlobClient import com.azure.storage.blob.specialized.PageBlobClient import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion +import spock.lang.Retry @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "V2020_10_02") class OAuthCopySourceTests extends APISpec { @@ -38,6 +40,8 @@ class OAuthCopySourceTests extends APISpec { pageBlobClient.create(PageBlobClient.PAGE_BYTES) } + // RBAC replication lag + @Retry(count = 5, delay = 30, condition = { env.testMode == TestMode.LIVE }) def "Append blob append block from URL source oauth"() { setup: def sourceBlob = cc.getBlobClient(generateBlobName()) @@ -70,6 +74,8 @@ class OAuthCopySourceTests extends APISpec { thrown(BlobStorageException) } + // RBAC replication lag + @Retry(count = 5, delay = 30, condition = { env.testMode == TestMode.LIVE }) def "Block blob upload from URL source oauth"() { setup: def oauthHeader = getAuthToken() @@ -100,6 +106,8 @@ class OAuthCopySourceTests extends APISpec { thrown(BlobStorageException) } + // RBAC replication lag + @Retry(count = 5, delay = 30, condition = { env.testMode == TestMode.LIVE }) def "Block blob stage block from URL source oauth"() { setup: def oauthHeader = getAuthToken() @@ -133,6 +141,8 @@ class OAuthCopySourceTests extends APISpec { thrown(BlobStorageException) } + // RBAC replication lag + @Retry(count = 5, delay = 30, condition = { env.testMode == TestMode.LIVE }) def "Upload pages from URL source oauth"() { setup: def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy index e8abcb52253f4..0b053b172b23a 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy @@ -1,6 +1,7 @@ package com.azure.storage.file.share import com.azure.core.http.HttpAuthorization +import com.azure.core.test.TestMode import com.azure.core.util.Context import com.azure.storage.blob.BlobClient import com.azure.storage.blob.BlobContainerClient @@ -8,6 +9,7 @@ import com.azure.storage.blob.BlobServiceClientBuilder import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion import com.azure.storage.file.share.models.ShareStorageException import com.azure.storage.file.share.options.ShareFileUploadRangeFromUrlOptions +import spock.lang.Retry @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "V2020_10_02") class OAuthCopySourceTests extends APISpec { @@ -43,6 +45,8 @@ class OAuthCopySourceTests extends APISpec { .createBlobContainer(getShareName()) } + // RBAC replication lag + @Retry(count = 5, delay = 30, condition = { env.testMode == TestMode.LIVE }) def "Copy from URL with oauth source"() { given: def oauthHeader = getAuthToken()