This commit is contained in:
microzchang 2024-04-28 14:36:09 +08:00 committed by GitHub
parent 56b5666b59
commit a64f75bc54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View File

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/storage",
"Tag": "cpp/storage_99c5e1edcb"
"Tag": "cpp/storage_fc81ec148a"
}

View File

@ -8,6 +8,8 @@
### Bugs Fixed
- Fixed a bug where `PathItem::EncryptionContext` returned by `DataLakeDirectoryClient::ListPaths` was always null.
### Other Changes
## 12.10.0-beta.1 (2024-04-17)

View File

@ -281,6 +281,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
item.ExpiresOn = _detail::Win32FileTimeConverter::Win32FileTimeToDateTime(
std::stoll(path.ExpiresOn.Value()));
}
item.EncryptionContext = std::move(path.EncryptionContext);
pagedResponse.Paths.push_back(std::move(item));
}
pagedResponse.m_directoryClient = std::make_shared<DataLakeDirectoryClient>(*this);

View File

@ -570,11 +570,14 @@ namespace Azure { namespace Storage { namespace Test {
}
}
TEST_F(DataLakeFileClientTest, CreateWithEncryptionContext_LIVEONLY_)
TEST_F(DataLakeFileClientTest, CreateWithEncryptionContext)
{
std::string encryptionContext = "encryptionContext";
const std::string fileName = RandomString();
auto fileClient = m_fileSystemClient->GetFileClient(fileName);
const std::string directoryName = LowercaseRandomString();
auto directoryClient = m_fileSystemClient->GetDirectoryClient(directoryName);
auto fileClient = directoryClient.GetFileClient(fileName);
directoryClient.Create();
Files::DataLake::CreateFileOptions options;
options.EncryptionContext = encryptionContext;
// Assert Create
@ -587,14 +590,19 @@ namespace Azure { namespace Storage { namespace Test {
auto downloadResult = fileClient.Download();
EXPECT_TRUE(downloadResult.Value.Details.EncryptionContext.HasValue());
EXPECT_EQ(encryptionContext, downloadResult.Value.Details.EncryptionContext.Value());
// Assert ListPaths
auto paths = m_fileSystemClient->ListPaths(false).Paths;
// Assert DataLakeDirectoryClient::ListPaths
auto paths = directoryClient.ListPaths(false).Paths;
EXPECT_EQ(paths.size(), 1);
EXPECT_TRUE(paths[0].EncryptionContext.HasValue());
EXPECT_EQ(encryptionContext, paths[0].EncryptionContext.Value());
// Assert DataLakeFileSystemClient::ListPaths
paths = m_fileSystemClient->ListPaths(true).Paths;
auto iter = std::find_if(
paths.begin(), paths.end(), [&fileName](const Files::DataLake::Models::PathItem& path) {
return path.Name == fileName;
paths.begin(), paths.end(), [](const Files::DataLake::Models::PathItem& path) {
return path.EncryptionContext.HasValue();
});
EXPECT_NE(paths.end(), iter);
EXPECT_TRUE(iter->EncryptionContext.HasValue());
EXPECT_EQ(encryptionContext, iter->EncryptionContext.Value());
}