Skip to content

Commit

Permalink
Allow to set default Redis server port (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafie authored Nov 20, 2022
1 parent d884ccf commit ff79442
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions RLTest/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def do_normal_conn(self, line):
'--env', '-e', default='oss', choices=['oss', 'oss-cluster', 'enterprise', 'enterprise-cluster', 'existing-env', 'cluster_existing-env'],
help='env on which to run the test')

parser.add_argument(
'-p', '--redis-port', type=int, default=6379,
help='Redis server port')

parser.add_argument(
'--existing-env-addr', default='localhost:6379',
help='Address of existing env, relevent only when running with existing-env, cluster_existing-env')
Expand Down Expand Up @@ -327,6 +331,10 @@ def __init__(self):
print(Colors.Green('RLTest version {}'.format(__version__)))
sys.exit(0)

if self.args.redis_port not in range(1, pow(2, 16)):
print(Colors.Bred(f'requested port {self.args.redis_port} is not valid'))
sys.exit(1)

if self.args.interactive_debugger:
if self.args.env != 'oss' and not (self.args.env == 'oss-cluster' and Defaults.num_shards == 1) and self.args.env != 'enterprise':
print(Colors.Bred('interactive debugger can only be used on non cluster env'))
Expand Down Expand Up @@ -417,6 +425,7 @@ def __init__(self):
Defaults.debugger = debugger
Defaults.sanitizer = sanitizer
Defaults.exit_on_failure = self.args.exit_on_failure
Defaults.port = self.args.redis_port
Defaults.external_addr = self.args.existing_env_addr
Defaults.use_unix = self.args.unix
Defaults.randomize_ports = self.args.randomize_ports
Expand Down
1 change: 1 addition & 0 deletions RLTest/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def getKwargs(self):
kwargs = {
'modulePath': self.module,
'moduleArgs': self.module_args,
'port': self.port,
'useSlaves': self.use_slaves,
'useAof': self.use_aof,
'useRdbPreamble': self.use_rdb_preamble,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "RLTest"
version = "0.5.9"
version = "0.5.10"
description="Redis Labs Test Framework, allow to run tests on redis and modules on a variety of environments"
authors = ["RedisLabs <[email protected]>"]
license = "BSD-3-Clause"
Expand Down

0 comments on commit ff79442

Please sign in to comment.