Merge pull request #6974 from yangbodong22011/fix-tcl-test-host-option

Fix bug of tcl test using external server
This commit is contained in:
Salvatore Sanfilippo 2020-03-13 12:27:26 +01:00 committed by GitHub
commit a96c0ceff6
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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