mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
Update some valkey-cli related in tcl (#236)
Signed-off-by: hwware <wen.hui.ware@gmail.com>
This commit is contained in:
parent
47444c67de
commit
7f5bcc96f0
@ -90,7 +90,7 @@ test "Cluster consistency during live resharding" {
|
||||
--cluster-to $target \
|
||||
--cluster-slots 100 \
|
||||
--cluster-yes \
|
||||
{*}[rediscli_tls_config "../../../tests"] \
|
||||
{*}[valkeycli_tls_config "../../../tests"] \
|
||||
| [info nameofexecutable] \
|
||||
../tests/helpers/onlydots.tcl \
|
||||
&] 0]
|
||||
|
@ -40,7 +40,7 @@ test "Resharding all the master #0 slots away from it" {
|
||||
set output [exec \
|
||||
../../../src/valkey-cli --cluster rebalance \
|
||||
127.0.0.1:[get_instance_attrib redis 0 port] \
|
||||
{*}[rediscli_tls_config "../../../tests"] \
|
||||
{*}[valkeycli_tls_config "../../../tests"] \
|
||||
--cluster-weight ${master0_id}=0 >@ stdout ]
|
||||
|
||||
}
|
||||
@ -61,7 +61,7 @@ test "Resharding back some slot to master #0" {
|
||||
set output [exec \
|
||||
../../../src/valkey-cli --cluster rebalance \
|
||||
127.0.0.1:[get_instance_attrib redis 0 port] \
|
||||
{*}[rediscli_tls_config "../../../tests"] \
|
||||
{*}[valkeycli_tls_config "../../../tests"] \
|
||||
--cluster-weight ${master0_id}=.01 \
|
||||
--cluster-use-empty-masters >@ stdout]
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ test "Resharding all the master #0 slots away from it" {
|
||||
set output [exec \
|
||||
../../../src/valkey-cli --cluster rebalance \
|
||||
127.0.0.1:[get_instance_attrib redis 0 port] \
|
||||
{*}[rediscli_tls_config "../../../tests"] \
|
||||
{*}[valkeycli_tls_config "../../../tests"] \
|
||||
--cluster-weight ${master0_id}=0 >@ stdout ]
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ proc config_set_all_nodes {keyword value} {
|
||||
|
||||
proc fix_cluster {addr} {
|
||||
set code [catch {
|
||||
exec ../../../src/valkey-cli {*}[rediscli_tls_config "../../../tests"] --cluster fix $addr << yes
|
||||
exec ../../../src/valkey-cli {*}[valkeycli_tls_config "../../../tests"] --cluster fix $addr << yes
|
||||
} result]
|
||||
if {$code != 0} {
|
||||
puts "redis-cli --cluster fix returns non-zero exit code, output below:\n$result"
|
||||
@ -17,7 +17,7 @@ proc fix_cluster {addr} {
|
||||
# but we can ignore that and rely on the check below.
|
||||
assert_cluster_state ok
|
||||
wait_for_condition 100 100 {
|
||||
[catch {exec ../../../src/valkey-cli {*}[rediscli_tls_config "../../../tests"] --cluster check $addr} result] == 0
|
||||
[catch {exec ../../../src/valkey-cli {*}[valkeycli_tls_config "../../../tests"] --cluster check $addr} result] == 0
|
||||
} else {
|
||||
puts "redis-cli --cluster check returns non-zero exit code, output below:\n$result"
|
||||
fail "Cluster could not settle with configuration"
|
||||
@ -28,7 +28,7 @@ proc wait_cluster_stable {} {
|
||||
wait_for_condition 1000 50 {
|
||||
[catch {exec ../../../src/valkey-cli --cluster \
|
||||
check 127.0.0.1:[get_instance_attrib redis 0 port] \
|
||||
{*}[rediscli_tls_config "../../../tests"] \
|
||||
{*}[valkeycli_tls_config "../../../tests"] \
|
||||
}] == 0
|
||||
} else {
|
||||
fail "Cluster doesn't stabilize"
|
||||
|
@ -12,7 +12,7 @@ start_server {tags {"cli"}} {
|
||||
set opts "-n $::dbnum"
|
||||
}
|
||||
set ::env(TERM) dumb
|
||||
set cmdline [rediscli [srv host] [srv port] $opts]
|
||||
set cmdline [valkeycli [srv host] [srv port] $opts]
|
||||
if {$infile ne ""} {
|
||||
set cmdline "$cmdline < $infile"
|
||||
set mode "r"
|
||||
@ -92,7 +92,7 @@ start_server {tags {"cli"}} {
|
||||
}
|
||||
|
||||
proc _run_cli {host port db opts args} {
|
||||
set cmd [rediscli $host $port [list -n $db {*}$args]]
|
||||
set cmd [valkeycli $host $port [list -n $db {*}$args]]
|
||||
foreach {key value} $opts {
|
||||
if {$key eq "pipe"} {
|
||||
set cmd "sh -c \"$value | $cmd\""
|
||||
@ -580,7 +580,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
|
||||
}
|
||||
|
||||
test "DUMP RESTORE with -x option" {
|
||||
set cmdline [rediscli [srv host] [srv port]]
|
||||
set cmdline [valkeycli [srv host] [srv port]]
|
||||
|
||||
exec {*}$cmdline DEL set new_set
|
||||
exec {*}$cmdline SADD set 1 2 3 4 5 6
|
||||
@ -594,7 +594,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
|
||||
}
|
||||
|
||||
test "DUMP RESTORE with -X option" {
|
||||
set cmdline [rediscli [srv host] [srv port]]
|
||||
set cmdline [valkeycli [srv host] [srv port]]
|
||||
|
||||
exec {*}$cmdline DEL zset new_zset
|
||||
exec {*}$cmdline ZADD zset 1 a 2 b 3 c
|
||||
|
@ -1,4 +1,4 @@
|
||||
proc rediscli_tls_config {testsdir} {
|
||||
proc valkeycli_tls_config {testsdir} {
|
||||
set tlsdir [file join $testsdir tls]
|
||||
set cert [file join $tlsdir client.crt]
|
||||
set key [file join $tlsdir client.key]
|
||||
@ -11,23 +11,23 @@ proc rediscli_tls_config {testsdir} {
|
||||
}
|
||||
}
|
||||
|
||||
# Returns command line for executing redis-cli
|
||||
proc rediscli {host port {opts {}}} {
|
||||
# Returns command line for executing valkey-cli
|
||||
proc valkeycli {host port {opts {}}} {
|
||||
set cmd [list src/valkey-cli -h $host -p $port]
|
||||
lappend cmd {*}[rediscli_tls_config "tests"]
|
||||
lappend cmd {*}[valkeycli_tls_config "tests"]
|
||||
lappend cmd {*}$opts
|
||||
return $cmd
|
||||
}
|
||||
|
||||
# Returns command line for executing redis-cli with a unix socket address
|
||||
proc rediscli_unixsocket {unixsocket {opts {}}} {
|
||||
# Returns command line for executing valkey-cli with a unix socket address
|
||||
proc valkeycli_unixsocket {unixsocket {opts {}}} {
|
||||
return [list src/valkey-cli -s $unixsocket {*}$opts]
|
||||
}
|
||||
|
||||
# Run redis-cli with specified args on the server of specified level.
|
||||
# Run valkey-cli with specified args on the server of specified level.
|
||||
# Returns output broken down into individual lines.
|
||||
proc rediscli_exec {level args} {
|
||||
set cmd [rediscli_unixsocket [srv $level unixsocket] $args]
|
||||
proc valkeycli_exec {level args} {
|
||||
set cmd [valkeycli_unixsocket [srv $level unixsocket] $args]
|
||||
set fd [open "|$cmd" "r"]
|
||||
set ret [lrange [split [read $fd] "\n"] 0 end-1]
|
||||
close $fd
|
||||
|
@ -121,18 +121,18 @@ start_server {config "minimal.conf" tags {"external:skip"}} {
|
||||
|
||||
# Make sure bind parameter is as expected and server handles binding
|
||||
# accordingly.
|
||||
# (it seems that rediscli_exec behaves differently in RESP3, possibly
|
||||
# because CONFIG GET returns a dict instead of a list so redis-cli emits
|
||||
# (it seems that valkeycli_exec behaves differently in RESP3, possibly
|
||||
# because CONFIG GET returns a dict instead of a list so valkey-cli emits
|
||||
# it in a single line)
|
||||
if {$::force_resp3} {
|
||||
assert_equal {{bind }} [rediscli_exec 0 config get bind]
|
||||
assert_equal {{bind }} [valkeycli_exec 0 config get bind]
|
||||
} else {
|
||||
assert_equal {bind {}} [rediscli_exec 0 config get bind]
|
||||
assert_equal {bind {}} [valkeycli_exec 0 config get bind]
|
||||
}
|
||||
catch {reconnect 0} err
|
||||
assert_match {*connection refused*} $err
|
||||
|
||||
assert_equal {OK} [rediscli_exec 0 config set bind *]
|
||||
assert_equal {OK} [valkeycli_exec 0 config set bind *]
|
||||
reconnect 0
|
||||
r ping
|
||||
} {PONG}
|
||||
|
Loading…
Reference in New Issue
Block a user