Fix bug (#5573)
This commit is contained in:
parent
56b5666b59
commit
a64f75bc54
@ -2,5 +2,5 @@
|
||||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "cpp",
|
||||
"TagPrefix": "cpp/storage",
|
||||
"Tag": "cpp/storage_99c5e1edcb"
|
||||
"Tag": "cpp/storage_fc81ec148a"
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user