summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-03-13 12:27:26 +0100
committerGitHub <noreply@github.com>2020-03-13 12:27:26 +0100
commit22ae0ddf1570e09d8a46e5d3b581b82cd79d75ad (patch)
treebb558bbd1890c2adf5d94f2cc91e7c6f01aa2c17
parentb1db7acf7219933c43b633078eda545b6439f0d3 (diff)
parent336458d4b5e54a2b7a637628d1237a6291e26299 (diff)
downloadredis-22ae0ddf1570e09d8a46e5d3b581b82cd79d75ad.tar.gz
Merge pull request #6974 from yangbodong22011/fix-tcl-test-host-option
Fix bug of tcl test using external server
-rw-r--r--tests/support/server.tcl7
-rw-r--r--tests/test_helper.tcl3
2 files changed, 8 insertions, 2 deletions
diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index d086366dc..400017c5f 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -159,9 +159,12 @@ proc start_server {options {code undefined}} {
if {$::external} {
if {[llength $::servers] == 0} {
set srv {}
+ # In test_server_main(tests/test_helper.tcl:215~218), increase the value of start_port
+ # and assign it to ::port through the `--port` option, so we need to reduce it.
+ set baseport [expr {$::port-100}]
dict set srv "host" $::host
- dict set srv "port" $::port
- set client [redis $::host $::port 0 $::tls]
+ dict set srv "port" $baseport
+ set client [redis $::host $baseport 0 $::tls]
dict set srv "client" $client
$client select 9
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl
index fa5579669..4dbead193 100644
--- a/tests/test_helper.tcl
+++ b/tests/test_helper.tcl
@@ -505,6 +505,9 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
} elseif {$opt eq {--host}} {
set ::external 1
set ::host $arg
+ # If we use an external server, we can only set numclients to 1,
+ # otherwise the port will be miscalculated.
+ set ::numclients 1
incr j
} elseif {$opt eq {--port}} {
set ::port $arg