adamreeve commented on code in PR #40329:
URL: https://github.com/apache/arrow/pull/40329#discussion_r1523944660
##########
cpp/src/parquet/encryption/key_management_test.cc:
##########
@@ -324,6 +324,37 @@ TEST_F(TestEncryptionKeyManagement,
KeyRotationWithInternalMaterial) {
EXPECT_THROW(this->RotateKeys(double_wrapping, encryption_no),
ParquetException);
}
+TEST_F(TestEncryptionKeyManagement, UsePropertiesAfterCrytoFactoryDestroyed) {
+ constexpr bool wrap_locally = true;
+ std::shared_ptr<KmsClientFactory> kms_client_factory =
+ std::make_shared<TestOnlyInMemoryKmsClientFactory>(wrap_locally,
key_list_);
+ std::shared_ptr<CryptoFactory> crypto_factory =
std::make_shared<CryptoFactory>();
+ crypto_factory->RegisterKmsClientFactory(kms_client_factory);
+
+ constexpr bool double_wrapping = true;
+ constexpr bool internal_key_material = true;
+ constexpr int encryption_no = 0;
+
+ std::string file_name =
+ GetFileName(double_wrapping, wrap_locally, internal_key_material,
encryption_no);
+ auto encryption_config =
+ GetEncryptionConfiguration(double_wrapping, internal_key_material,
encryption_no);
+ auto decryption_config = GetDecryptionConfiguration();
+
+ auto file_encryption_properties =
crypto_factory->GetFileEncryptionProperties(
+ kms_connection_config_, encryption_config);
+ auto file_decryption_properties =
crypto_factory->GetFileDecryptionProperties(
+ kms_connection_config_, decryption_config);
+
+ // Free CryptoFactory
+ crypto_factory.reset();
Review Comment:
I've tried to make the test more realistic by creating the file encryption
properties and decryption properties in methods that use a local crypto
factory, which I think is the main scenario where this issue is likely to
happen.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]