diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index e2b2114cf..bc7c2cbc6 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_789a3955d8" + "Tag": "cpp/storage_62e8551aa8" } diff --git a/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp index c9339eb46..958d90591 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp @@ -466,10 +466,10 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_FALSE(userDelegationKey.Value.empty()); } - TEST_F(BlobServiceClientTest, DISABLED_RenameBlobContainer) + TEST_F(BlobServiceClientTest, RenameBlobContainer_PLAYBACKONLY_) { auto serviceClient = *m_blobServiceClient; - const std::string prefix = RandomString(); + const std::string prefix = LowercaseRandomString() + "2"; const std::string srcContainerName = prefix + "src"; auto srcContainerClient = serviceClient.CreateBlobContainer(srcContainerName).Value; @@ -481,13 +481,12 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_THROW(srcContainerClient.GetProperties(), StorageException); EXPECT_NO_THROW(destContainerClient.GetProperties()); - Blobs::BlobLeaseClient leaseClient( - destContainerClient, Blobs::BlobLeaseClient::CreateUniqueLeaseId()); + Blobs::BlobLeaseClient leaseClient(destContainerClient, RandomUUID()); leaseClient.Acquire(std::chrono::seconds(60)); const std::string destContainerName2 = prefix + "dest2"; Blobs::RenameBlobContainerOptions renameOptions; - renameOptions.SourceAccessConditions.LeaseId = Blobs::BlobLeaseClient::CreateUniqueLeaseId(); + renameOptions.SourceAccessConditions.LeaseId = RandomUUID(); EXPECT_THROW( serviceClient.RenameBlobContainer(destContainerName, destContainerName2, renameOptions), StorageException); diff --git a/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp index eed53d72d..14f867abf 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp @@ -322,7 +322,7 @@ namespace Azure { namespace Storage { namespace Test { } } - TEST_F(BlockBlobClientTest, DISABLED_LastAccessTime) + TEST_F(BlockBlobClientTest, LastAccessTime) { auto blobClient = *m_blockBlobClient; @@ -1101,7 +1101,7 @@ namespace Azure { namespace Storage { namespace Test { std::this_thread::sleep_for(ImmutabilityMaxLength); } - TEST_F(BlockBlobClientTest, DISABLED_LegalHold) + TEST_F(BlockBlobClientTest, LegalHold_PLAYBACKONLY_) { const auto testName = m_blobName; auto blobClient = *m_blockBlobClient; diff --git a/sdk/storage/azure-storage-common/test/ut/test_base.cpp b/sdk/storage/azure-storage-common/test/ut/test_base.cpp index 1ea0b7447..710c5d507 100644 --- a/sdk/storage/azure-storage-common/test/ut/test_base.cpp +++ b/sdk/storage/azure-storage-common/test/ut/test_base.cpp @@ -57,6 +57,16 @@ namespace Azure { namespace Storage { namespace Test { std::seed_seq seedSeq(seedStr.begin(), seedStr.end()); m_randomGenerator.seed(seedSeq); } + const std::string playbackOnlyToken = PlaybackOnlyToken; + const std::string testName = m_testContext.GetTestName(); + if (testName.length() >= playbackOnlyToken.length() + && testName.substr(testName.length() - playbackOnlyToken.length()) == playbackOnlyToken) + { + if (m_testContext.IsLiveMode()) + { + SkipTest(); + } + } } void StorageTest::TearDown() diff --git a/sdk/storage/azure-storage-common/test/ut/test_base.hpp b/sdk/storage/azure-storage-common/test/ut/test_base.hpp index 712bb1856..8a6dc2b2c 100644 --- a/sdk/storage/azure-storage-common/test/ut/test_base.hpp +++ b/sdk/storage/azure-storage-common/test/ut/test_base.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -55,17 +56,22 @@ namespace Azure { namespace Storage { */ std::string GetIdentifier() const { - size_t MaxLength = 63; - std::string name = m_testContext.GetTestSuiteName() + m_testContext.GetTestName(); - if (name[0] == '-') + const size_t MaxLength = 63; + const std::string name = m_testContext.GetTestSuiteName() + m_testContext.GetTestName(); + std::string formattedName; + for (const auto c : name) { - name = name.substr(1); + if (std::isalnum(c)) + { + formattedName += c; + } + if (formattedName.length() >= MaxLength) + { + break; + } } - if (name.length() > MaxLength) - { - name.resize(MaxLength); - } - return name; + + return formattedName; } /** @@ -173,6 +179,8 @@ namespace Azure { namespace Storage { private: std::mt19937_64 m_randomGenerator; + + constexpr static const char* PlaybackOnlyToken = "_PLAYBACKONLY_"; }; constexpr inline unsigned long long operator""_KB(unsigned long long x) { return x * 1024; } diff --git a/sdk/storage/test-resources-post.ps1 b/sdk/storage/test-resources-post.ps1 index eeb5cbda8..fe44bfe6a 100644 --- a/sdk/storage/test-resources-post.ps1 +++ b/sdk/storage/test-resources-post.ps1 @@ -12,6 +12,8 @@ New-AzStorageEncryptionScope -ResourceGroupName $ResourceGroupName -StorageAccou Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName $ResourceGroupName -StorageAccountName $DeploymentOutputs['DATALAKE_ACCOUNT_NAME'] -RetentionDays 7 +Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName $ResourceGroupName -StorageAccountName $DeploymentOutputs['ACCOUNT_NAME'] -PassThru + # This script is used to wait until XCache is refreshed for the service properties (30s), and role assignment takes effect (300s). Start-Sleep -s 300