From 46b9a620162ea2c56b51fb50ba7ac31447449d9b Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 5 Oct 2023 17:01:55 +0300 Subject: [PATCH 1/4] add the option to edit protected configs --- RLTest/redis_std.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RLTest/redis_std.py b/RLTest/redis_std.py index d1909fc..66b097a 100644 --- a/RLTest/redis_std.py +++ b/RLTest/redis_std.py @@ -234,7 +234,7 @@ def createCmdArgs(self, role): if self.enableDebugCommand: if self._getRedisVersion() > 70000: - cmdArgs += ['--enable-debug-command', 'yes'] + cmdArgs += ['--enable-debug-command', 'yes', '--enable-protected-configs', 'yes'] return cmdArgs From 76f2739969d941db7fccc0b2bf24bbb777c71bc5 Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 9 Oct 2023 14:25:32 +0300 Subject: [PATCH 2/4] add the option to edit protected configs --- RLTest/__main__.py | 5 +++++ RLTest/env.py | 9 +++++++-- RLTest/redis_std.py | 11 +++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/RLTest/__main__.py b/RLTest/__main__.py index bb3a738..a502e30 100644 --- a/RLTest/__main__.py +++ b/RLTest/__main__.py @@ -273,6 +273,10 @@ def do_normal_conn(self, line): '--enable-debug-command', action='store_const', const=True, default=False, help='On Redis 7, debug command need to be enabled in order to be used.') +parser.add_argument( + '--enable-protected-configs', action='store_const', const=True, default=False, + help='On Redis 7, this option needs to be enabled in order to change protected configuration in runtime.') + parser.add_argument('--check-exitcode', help='Check redis process exit code', default=False, action='store_true') @@ -438,6 +442,7 @@ def __init__(self): Defaults.oss_password = self.args.oss_password Defaults.cluster_node_timeout = self.args.cluster_node_timeout Defaults.enable_debug_command = self.args.enable_debug_command + Defaults.enable_protected_configs = self.args.enable_protected_configs if Defaults.use_unix and Defaults.use_slaves: raise Exception('Cannot use unix sockets with slaves') diff --git a/RLTest/env.py b/RLTest/env.py index 2ed804c..f7bd995 100644 --- a/RLTest/env.py +++ b/RLTest/env.py @@ -144,6 +144,7 @@ class Defaults: curr_test_name = None port=6379 enable_debug_command=False + enable_protected_configs=False terminate_retries=None terminate_retry_secs=None @@ -176,7 +177,7 @@ def getKwargs(self): class Env: RTestInstance = None EnvCompareParams = ['module', 'moduleArgs', 'env', 'useSlaves', 'shardsCount', 'useAof', - 'useRdbPreamble', 'forceTcp', 'enableDebugCommand', 'protocol'] + 'useRdbPreamble', 'forceTcp', 'enableDebugCommand', 'enableProtectedConfigs', 'protocol'] def compareEnvs(self, env): if env is None: @@ -191,7 +192,8 @@ 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, - freshEnv=False, enableDebugCommand=None, protocol=2, terminateRetries=None, terminateRetrySecs=None): + freshEnv=False, enableDebugCommand=None, enableProtectedConfigs=None, protocol=2, + terminateRetries=None, terminateRetrySecs=None): self.testName = testName if testName else Defaults.curr_test_name if self.testName is None: @@ -229,6 +231,8 @@ def __init__(self, testName=None, testDescription=None, module=None, self.clusterNodeTimeout = clusterNodeTimeout if clusterNodeTimeout else Defaults.cluster_node_timeout self.port = Defaults.port self.enableDebugCommand = enableDebugCommand if enableDebugCommand else Defaults.enable_debug_command + self.enableProtectedConfigs = enableProtectedConfigs if enableProtectedConfigs\ + else Defaults.enable_protected_configs self.terminateRetries = terminateRetries self.terminateRetrySecs = terminateRetrySecs @@ -334,6 +338,7 @@ def getEnvKwargs(self): 'tlsPassphrase': self.tlsPassphrase, 'port': self.port, 'enableDebugCommand': self.enableDebugCommand, + 'enableProtectedConfigs': self.enableProtectedConfigs, 'protocol': self.protocol, 'terminateRetries': self.terminateRetries, 'terminateRetrySecs': self.terminateRetrySecs, diff --git a/RLTest/redis_std.py b/RLTest/redis_std.py index 66b097a..779924c 100644 --- a/RLTest/redis_std.py +++ b/RLTest/redis_std.py @@ -22,7 +22,7 @@ def __init__(self, redisBinaryPath, port=6379, modulePath=None, moduleArgs=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, - terminateRetries=None, terminateRetrySecs=None): + terminateRetries=None, terminateRetrySecs=None, enableProtectedConfigs=False): self.uuid = uuid.uuid4().hex self.redisBinaryPath = os.path.expanduser(redisBinaryPath) if redisBinaryPath.startswith( '~/') else redisBinaryPath @@ -58,6 +58,7 @@ def __init__(self, redisBinaryPath, port=6379, modulePath=None, moduleArgs=None, self.clusterNodeTimeout = clusterNodeTimeout self.tlsPassphrase = tlsPassphrase self.enableDebugCommand = enableDebugCommand + self.enableProtectedConfigs = enableProtectedConfigs self.protocol = protocol self.terminateRetries = terminateRetries self.terminateRetrySecs = terminateRetrySecs @@ -232,9 +233,11 @@ def createCmdArgs(self, role): cmdArgs += ['--tls-replication', 'yes'] - if self.enableDebugCommand: - if self._getRedisVersion() > 70000: - cmdArgs += ['--enable-debug-command', 'yes', '--enable-protected-configs', 'yes'] + if self._getRedisVersion() > 70000: + if self.enableDebugCommand: + cmdArgs += ['--enable-debug-command', 'yes'] + if self.enableProtectedConfigs: + cmdArgs += ['--enable-protected-configs', 'yes'] return cmdArgs From b7d522d6527b1faf9ba34f2749dd223fe4aa4636 Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 9 Oct 2023 14:26:53 +0300 Subject: [PATCH 3/4] Add debug commands and protected configs to RLTest defaults --- config.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.txt b/config.txt index 76866d4..d2b1c84 100644 --- a/config.txt +++ b/config.txt @@ -1,3 +1,5 @@ #-vv --clear-logs +--enable-debug-commands +--enable-protected-configs #--debug From ff39f432a36b99e58b72ca6af0601587e893ba0d Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 9 Oct 2023 14:43:17 +0300 Subject: [PATCH 4/4] fix typo --- config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.txt b/config.txt index d2b1c84..8dbe6cc 100644 --- a/config.txt +++ b/config.txt @@ -1,5 +1,5 @@ #-vv --clear-logs ---enable-debug-commands +--enable-debug-command --enable-protected-configs #--debug