Support to use environment variable to test customer encryption plugins (#12025)

Summary:
The CreateEnvTest.CreateEncryptedFileSystem unit test is to verify the creation functionality of EncryptedFileSystem, but now it just support the builtin CTREncryptionProvider class.
This patch make it flexible to use environment variable `TEST_FS_URI`, it is useful to test customer encryption plugins.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12025

Reviewed By: anand1976

Differential Revision: D50799656

Pulled By: ajkr

fbshipit-source-id: dbcacfefbf07de9c7803f7707b34c5193bec17bf
This commit is contained in:
Yingchun Lai 2023-11-09 10:45:13 -08:00 committed by Facebook GitHub Bot
parent e90e9825b4
commit c4c62c2304
1 changed files with 7 additions and 0 deletions

7
env/env_test.cc vendored
View File

@ -2906,6 +2906,13 @@ TEST_F(CreateEnvTest, CreateEncryptedFileSystem) {
std::string base_opts =
std::string("provider=1://test; id=") + EncryptedFileSystem::kClassName();
// Rewrite the default FileSystem URI if the "TEST_FS_URI" environment
// variable is set. This is useful to test customer encryption plugins.
const char* uri = getenv("TEST_FS_URI");
if (uri != nullptr) {
base_opts = uri;
}
// The EncryptedFileSystem requires a "provider" option.
ASSERT_NOK(FileSystem::CreateFromString(
config_options_, EncryptedFileSystem::kClassName(), &fs));