summaryrefslogtreecommitdiff
path: root/tests/instances.tcl
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-05-26 11:00:48 +0300
committerOran Agra <oran@redislabs.com>2020-05-26 11:17:08 +0300
commite258a1c0877d825c1675251620f817f5333c1446 (patch)
tree9207923c40d163a0a2ba325dc1199a038963f198 /tests/instances.tcl
parentb89e6d74faa27c9edf9d5e867a408b6b5c39b05e (diff)
downloadredis-e258a1c0877d825c1675251620f817f5333c1446.tar.gz
tests: each test client work on a distinct port range
apparently when running tests in parallel (the default of --clients 16), there's a chance for two tests to use the same port. specifically, one test might shutdown a master and still have the replica up, and then another test will re-use the port number of master for another master, and then that replica will connect to the master of the other test. this can cause a master to count too many full syncs and fail a test if we run the tests with --single integration/psync2 --loop --stop see Probmem 2 in #7314
Diffstat (limited to 'tests/instances.tcl')
-rw-r--r--tests/instances.tcl3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/instances.tcl b/tests/instances.tcl
index 0a0cbab12..3a4fadca0 100644
--- a/tests/instances.tcl
+++ b/tests/instances.tcl
@@ -25,6 +25,7 @@ set ::sentinel_instances {}
set ::redis_instances {}
set ::sentinel_base_port 20000
set ::redis_base_port 30000
+set ::redis_port_count 1024
set ::pids {} ; # We kill everything at exit
set ::dirs {} ; # We remove all the temp dirs at exit
set ::run_matching {} ; # If non empty, only tests matching pattern are run.
@@ -57,7 +58,7 @@ proc exec_instance {type cfgfile} {
# Spawn a redis or sentinel instance, depending on 'type'.
proc spawn_instance {type base_port count {conf {}}} {
for {set j 0} {$j < $count} {incr j} {
- set port [find_available_port $base_port]
+ set port [find_available_port $base_port $::redis_port_count]
incr base_port
puts "Starting $type #$j at port $port"