diff --git a/RLTest/__main__.py b/RLTest/__main__.py index 9bb7143..f9d783e 100644 --- a/RLTest/__main__.py +++ b/RLTest/__main__.py @@ -148,6 +148,12 @@ def do_normal_conn(self, line): '--cluster_node_timeout', default=5000, help='sets the node timeout on cluster in milliseconds') +parser.add_argument( + '--cluster_bus_port_protected_mode', default=None, choices=['yes', 'no'], + help='sets cluster-bus-port-protected-mode; only pass it to a redis that has the option ' + '(8.12 and up, or a backported 8.2.10/8.4.7/8.6.7/8.8.3/8.10.2), as an unknown ' + 'directive stops the server from starting') + parser.add_argument( '--cluster-start-timeout', default=40, type=int, help='timeout in seconds to wait for cluster to be ready (default 40 seconds). ' @@ -543,6 +549,7 @@ def __init__(self): Defaults.tls_passphrase = self.args.tls_passphrase Defaults.oss_password = self.args.oss_password Defaults.cluster_node_timeout = self.args.cluster_node_timeout + Defaults.cluster_bus_port_protected_mode = self.args.cluster_bus_port_protected_mode Defaults.cluster_start_timeout = self.args.cluster_start_timeout if Defaults.cluster_start_timeout < 5: raise Exception('--cluster-start-timeout must be at least 5 seconds') diff --git a/RLTest/env.py b/RLTest/env.py index ed6e68d..47a4915 100644 --- a/RLTest/env.py +++ b/RLTest/env.py @@ -142,6 +142,7 @@ class Defaults: randomize_ports = False oss_password = None cluster_node_timeout = None + cluster_bus_port_protected_mode = None cluster_start_timeout = 40 curr_test_name = None port = 6379 @@ -188,7 +189,8 @@ class Env: RTestInstance = None EnvCompareParams = ['module', 'moduleArgs', 'env', 'useSlaves', 'shardsCount', 'useAof', 'useRdbPreamble', 'forceTcp', 'enableDebugCommand', 'enableProtectedConfigs', - 'enableModuleCommand', 'protocol', 'password'] + 'enableModuleCommand', 'protocol', 'password', + 'clusterBusPortProtectedMode'] def __new__(cls, *args, **kwargs): if cls is Env and Defaults.env_class is not None: @@ -208,6 +210,7 @@ def __init__(self, testName=None, testDescription=None, module=None, useAof=None, useRdbPreamble=None, forceTcp=False, useTLS=False, tlsCertFile=None, tlsKeyFile=None, tlsCaCertFile=None, tlsPassphrase=None, logDir=None, redisBinaryPath=None, dmcBinaryPath=None, redisEnterpriseBinaryPath=None, noDefaultModuleArgs=False, clusterNodeTimeout = None, + clusterBusPortProtectedMode=None, freshEnv=False, enableDebugCommand=None, enableModuleCommand=None, enableProtectedConfigs=None, protocol=None, terminateRetries=None, terminateRetrySecs=None, redisConfigFile=None, dualTLS=False, startupGraceSecs=None): @@ -247,6 +250,7 @@ def __init__(self, testName=None, testDescription=None, module=None, self.dmcBinaryPath = expandBinary(dmcBinaryPath) if dmcBinaryPath else Defaults.proxy_binary self.redisEnterpriseBinaryPath = expandBinary(redisEnterpriseBinaryPath) if redisEnterpriseBinaryPath else Defaults.re_binary self.clusterNodeTimeout = clusterNodeTimeout if clusterNodeTimeout else Defaults.cluster_node_timeout + self.clusterBusPortProtectedMode = clusterBusPortProtectedMode if clusterBusPortProtectedMode is not None else Defaults.cluster_bus_port_protected_mode self.port = Defaults.port self.enableDebugCommand = enableDebugCommand if enableDebugCommand is not None else Defaults.enable_debug_command self.enableProtectedConfigs = enableProtectedConfigs if enableProtectedConfigs is not None\ @@ -373,6 +377,7 @@ def getEnvKwargs(self): 'tlsKeyFile': self.tlsKeyFile, 'tlsCaCertFile': self.tlsCaCertFile, 'clusterNodeTimeout': self.clusterNodeTimeout, + 'clusterBusPortProtectedMode': self.clusterBusPortProtectedMode, 'tlsPassphrase': self.tlsPassphrase, 'port': self.port, 'enableDebugCommand': self.enableDebugCommand, diff --git a/RLTest/redis_std.py b/RLTest/redis_std.py index 6ad0065..aa5337f 100644 --- a/RLTest/redis_std.py +++ b/RLTest/redis_std.py @@ -21,7 +21,7 @@ class StandardEnv(object): def __init__(self, redisBinaryPath, port=6379, modulePath=None, moduleArgs=None, outputFilesFormat=None, dbDirPath=None, useSlaves=False, serverId=1, password=None, libPath=None, clusterEnabled=False, decodeResponses=False, useAof=False, useRdbPreamble=True, debugger=None, sanitizer=None, noCatch=False, noLog=False, unix=False, verbose=False, useTLS=False, - tlsCertFile=None, tlsKeyFile=None, tlsCaCertFile=None, clusterNodeTimeout=None, tlsPassphrase=None, enableDebugCommand=False, protocol=2, + tlsCertFile=None, tlsKeyFile=None, tlsCaCertFile=None, clusterNodeTimeout=None, clusterBusPortProtectedMode=None, tlsPassphrase=None, enableDebugCommand=False, protocol=2, terminateRetries=None, terminateRetrySecs=None, enableProtectedConfigs=False, enableModuleCommand=False, loglevel=None, redisConfigFile=None, dualTLS=False, startupGraceSecs=0.1 ): @@ -63,6 +63,11 @@ def __init__(self, redisBinaryPath, port=6379, modulePath=None, moduleArgs=None, self.tlsKeyFile = tlsKeyFile self.tlsCaCertFile = tlsCaCertFile self.clusterNodeTimeout = clusterNodeTimeout + # None emits nothing. Set it only for a redis that has the option, as an unknown + # directive stops the server from starting: 8.12 and up, where it also defaults to + # enabled and so refuses an unauthenticated cluster bus, or one of the backports + # (8.2.10, 8.4.7, 8.6.7, 8.8.3, 8.10.2), where it defaults to disabled. + self.clusterBusPortProtectedMode = clusterBusPortProtectedMode self.tlsPassphrase = tlsPassphrase self.enableDebugCommand = enableDebugCommand self.enableModuleCommand = enableModuleCommand @@ -233,6 +238,9 @@ def createCmdArgs(self, role): '--cluster-node-timeout', '5000' if self.clusterNodeTimeout is None else str(self.clusterNodeTimeout)] if self.useTLS: cmdArgs += ['--tls-cluster', 'yes'] + if self.clusterBusPortProtectedMode is not None: + cmdArgs += ['--cluster-bus-port-protected-mode', + 'yes' if self.clusterBusPortProtectedMode in (True, 'yes') else 'no'] if self.useAof: cmdArgs += ['--appendonly', 'yes'] cmdArgs += ['--appendfilename', self._getFileName(role, '.aof')]