Enable some storage test cases (#4856)
* fix container name * test last access time * recording * playback only test cases * legalhold
This commit is contained in:
parent
56c9f47c16
commit
950a39e3f1
@ -2,5 +2,5 @@
|
||||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "cpp",
|
||||
"TagPrefix": "cpp/storage",
|
||||
"Tag": "cpp/storage_789a3955d8"
|
||||
"Tag": "cpp/storage_62e8551aa8"
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <azure/storage/common/internal/constants.hpp>
|
||||
#include <azure/storage/common/storage_common.hpp>
|
||||
|
||||
#include <cctype>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
@ -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; }
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user