Add tenant mode option to fdbclient tests
This commit is contained in:
parent
735b78cd0c
commit
11db333b7b
|
@ -403,7 +403,7 @@ endfunction()
|
|||
|
||||
# Creates a single cluster before running the specified command (usually a ctest test)
|
||||
function(add_fdbclient_test)
|
||||
set(options DISABLED ENABLED DISABLE_LOG_DUMP API_TEST_BLOB_GRANULES_ENABLED TLS_ENABLED)
|
||||
set(options DISABLED ENABLED DISABLE_TENANTS DISABLE_LOG_DUMP API_TEST_BLOB_GRANULES_ENABLED TLS_ENABLED)
|
||||
set(oneValueArgs NAME PROCESS_NUMBER TEST_TIMEOUT WORKING_DIRECTORY)
|
||||
set(multiValueArgs COMMAND)
|
||||
cmake_parse_arguments(T "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
||||
|
@ -430,6 +430,9 @@ function(add_fdbclient_test)
|
|||
if(T_DISABLE_LOG_DUMP)
|
||||
list(APPEND TMP_CLUSTER_CMD --disable-log-dump)
|
||||
endif()
|
||||
if(T_DISABLE_TENANTS)
|
||||
list(APPEND TMP_CLUSTER_CMD --disable-tenants)
|
||||
endif()
|
||||
if(T_API_TEST_BLOB_GRANULES_ENABLED)
|
||||
list(APPEND TMP_CLUSTER_CMD --blob-granules-enabled)
|
||||
endif()
|
||||
|
|
|
@ -18,6 +18,7 @@ class TempCluster(LocalCluster):
|
|||
port: str = None,
|
||||
blob_granules_enabled: bool = False,
|
||||
tls_config: TLSConfig = None,
|
||||
enable_tenants: bool = True,
|
||||
):
|
||||
self.build_dir = Path(build_dir).resolve()
|
||||
assert self.build_dir.exists(), "{} does not exist".format(build_dir)
|
||||
|
@ -25,6 +26,7 @@ class TempCluster(LocalCluster):
|
|||
tmp_dir = self.build_dir.joinpath("tmp", random_secret_string(16))
|
||||
tmp_dir.mkdir(parents=True)
|
||||
self.tmp_dir = tmp_dir
|
||||
self.enable_tenants = enable_tenants
|
||||
super().__init__(
|
||||
tmp_dir,
|
||||
self.build_dir.joinpath("bin", "fdbserver"),
|
||||
|
@ -39,7 +41,10 @@ class TempCluster(LocalCluster):
|
|||
|
||||
def __enter__(self):
|
||||
super().__enter__()
|
||||
super().create_database()
|
||||
if self.enable_tenants:
|
||||
super().create_database()
|
||||
else:
|
||||
super().create_database(enable_tenants=False)
|
||||
return self
|
||||
|
||||
def __exit__(self, xc_type, exc_value, traceback):
|
||||
|
@ -91,6 +96,12 @@ if __name__ == "__main__":
|
|||
help="Do not dump cluster log on error",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--disable-tenants",
|
||||
help="Do not enable tenant mode",
|
||||
action="store_true",
|
||||
default=False
|
||||
)
|
||||
parser.add_argument(
|
||||
"--blob-granules-enabled", help="Enable blob granules", action="store_true"
|
||||
)
|
||||
|
@ -115,6 +126,12 @@ if __name__ == "__main__":
|
|||
default="Check.Valid=1",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.disable_tenants:
|
||||
enable_tenants = False
|
||||
else:
|
||||
enable_tenants = True
|
||||
|
||||
tls_config = None
|
||||
if args.tls_enabled:
|
||||
tls_config = TLSConfig(server_chain_len=args.server_cert_chain_len,
|
||||
|
@ -125,6 +142,7 @@ if __name__ == "__main__":
|
|||
args.process_number,
|
||||
blob_granules_enabled=args.blob_granules_enabled,
|
||||
tls_config=tls_config,
|
||||
enable_tenants=enable_tenants,
|
||||
) as cluster:
|
||||
print("log-dir: {}".format(cluster.log))
|
||||
print("etc-dir: {}".format(cluster.etc))
|
||||
|
|
Loading…
Reference in New Issue