Tests: fix redis-cli with remote hosts. (#7693)

This commit is contained in:
Yossi Gottlieb 2020-08-23 10:17:43 +03:00 committed by GitHub
parent e61adc0d89
commit f80f3f492a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -3,7 +3,7 @@ source tests/support/cli.tcl
start_server {tags {"cli"}} { start_server {tags {"cli"}} {
proc open_cli {{opts "-n 9"} {infile ""}} { proc open_cli {{opts "-n 9"} {infile ""}} {
set ::env(TERM) dumb set ::env(TERM) dumb
set cmdline [rediscli [srv port] $opts] set cmdline [rediscli [srv host] [srv port] $opts]
if {$infile ne ""} { if {$infile ne ""} {
set cmdline "$cmdline < $infile" set cmdline "$cmdline < $infile"
set mode "r" set mode "r"
@ -65,7 +65,7 @@ start_server {tags {"cli"}} {
} }
proc _run_cli {opts args} { proc _run_cli {opts args} {
set cmd [rediscli [srv port] [list -n 9 {*}$args]] set cmd [rediscli [srv host] [srv port] [list -n 9 {*}$args]]
foreach {key value} $opts { foreach {key value} $opts {
if {$key eq "pipe"} { if {$key eq "pipe"} {
set cmd "sh -c \"$value | $cmd\"" set cmd "sh -c \"$value | $cmd\""

View File

@ -11,8 +11,8 @@ proc rediscli_tls_config {testsdir} {
} }
} }
proc rediscli {port {opts {}}} { proc rediscli {host port {opts {}}} {
set cmd [list src/redis-cli -p $port] set cmd [list src/redis-cli -h $host -p $port]
lappend cmd {*}[rediscli_tls_config "tests"] lappend cmd {*}[rediscli_tls_config "tests"]
lappend cmd {*}$opts lappend cmd {*}$opts
return $cmd return $cmd

View File

@ -33,7 +33,7 @@ start_server {} {
} }
test {WAIT should not acknowledge 1 additional copy if slave is blocked} { test {WAIT should not acknowledge 1 additional copy if slave is blocked} {
set cmd [rediscli $slave_port "-h $slave_host debug sleep 5"] set cmd [rediscli $slave_host $slave_port "debug sleep 5"]
exec {*}$cmd > /dev/null 2> /dev/null & exec {*}$cmd > /dev/null 2> /dev/null &
after 1000 ;# Give redis-cli the time to execute the command. after 1000 ;# Give redis-cli the time to execute the command.
$master set foo 0 $master set foo 0