Skip to content

Commit

Permalink
Moved to correct cli and benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
madolson committed Mar 22, 2024
1 parent ee10748 commit 3586485
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion tests/cluster/tests/04-resharding.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ test "Cluster consistency during live resharding" {
flush stdout
set target [dict get [get_myself [randomInt 5]] id]
set tribpid [lindex [exec \
../../../src/redis-cli --cluster reshard \
../../../src/placeholderkv-cli --cluster reshard \
127.0.0.1:[get_instance_attrib redis 0 port] \
--cluster-from all \
--cluster-to $target \
Expand Down
4 changes: 2 additions & 2 deletions tests/cluster/tests/12-replica-migration-2.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test "Set allow-replica-migration yes" {
set master0_id [dict get [get_myself 0] id]
test "Resharding all the master #0 slots away from it" {
set output [exec \
../../../src/redis-cli --cluster rebalance \
../../../src/placeholderkv-cli --cluster rebalance \
127.0.0.1:[get_instance_attrib redis 0 port] \
{*}[rediscli_tls_config "../../../tests"] \
--cluster-weight ${master0_id}=0 >@ stdout ]
Expand All @@ -59,7 +59,7 @@ test "Resharding back some slot to master #0" {
# new resharding.
after 10000
set output [exec \
../../../src/redis-cli --cluster rebalance \
../../../src/placeholderkv-cli --cluster rebalance \
127.0.0.1:[get_instance_attrib redis 0 port] \
{*}[rediscli_tls_config "../../../tests"] \
--cluster-weight ${master0_id}=.01 \
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/12.1-replica-migration-3.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test "Set allow-replica-migration no" {
set master0_id [dict get [get_myself 0] id]
test "Resharding all the master #0 slots away from it" {
set output [exec \
../../../src/redis-cli --cluster rebalance \
../../../src/placeholderkv-cli --cluster rebalance \
127.0.0.1:[get_instance_attrib redis 0 port] \
{*}[rediscli_tls_config "../../../tests"] \
--cluster-weight ${master0_id}=0 >@ stdout ]
Expand Down
6 changes: 3 additions & 3 deletions tests/cluster/tests/includes/utils.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ proc config_set_all_nodes {keyword value} {

proc fix_cluster {addr} {
set code [catch {
exec ../../../src/redis-cli {*}[rediscli_tls_config "../../../tests"] --cluster fix $addr << yes
exec ../../../src/placeholderkv-cli {*}[rediscli_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"
Expand All @@ -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/redis-cli {*}[rediscli_tls_config "../../../tests"] --cluster check $addr} result] == 0
[catch {exec ../../../src/placeholderkv-cli {*}[rediscli_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"
Expand All @@ -26,7 +26,7 @@ proc fix_cluster {addr} {

proc wait_cluster_stable {} {
wait_for_condition 1000 50 {
[catch {exec ../../../src/redis-cli --cluster \
[catch {exec ../../../src/placeholderkv-cli --cluster \
check 127.0.0.1:[get_instance_attrib redis 0 port] \
{*}[rediscli_tls_config "../../../tests"] \
}] == 0
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/aof-race.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags {"aof external:skip"} {
# was subsequently appended to the new AOF, resulting in duplicate commands.
start_server_aof [list dir $server_path] {
set client [redis [srv host] [srv port] 0 $::tls]
set bench [open "|src/redis-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"]
set bench [open "|src/placeholderkv-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"]

wait_for_condition 100 1 {
[$client get foo] > 0
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/psync2-reg.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ start_server {} {
}

set cycle_start_time [clock milliseconds]
set bench_pid [exec src/redis-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &]
set bench_pid [exec src/placeholderkv-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &]
while 1 {
set elapsed [expr {[clock milliseconds]-$cycle_start_time}]
if {$elapsed > $duration*1000} break
Expand Down
6 changes: 3 additions & 3 deletions tests/support/benchmark.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ proc redisbenchmark_tls_config {testsdir} {
}

proc redisbenchmark {host port {opts {}}} {
set cmd [list src/redis-benchmark -h $host -p $port]
set cmd [list src/placeholderkv-benchmark -h $host -p $port]
lappend cmd {*}[redisbenchmark_tls_config "tests"]
lappend cmd {*}$opts
return $cmd
}

proc redisbenchmarkuri {host port {opts {}}} {
set cmd [list src/redis-benchmark -u redis://$host:$port]
set cmd [list src/placeholderkv-benchmark -u redis://$host:$port]
lappend cmd {*}[redisbenchmark_tls_config "tests"]
lappend cmd {*}$opts
return $cmd
}

proc redisbenchmarkuriuserpass {host port user pass {opts {}}} {
set cmd [list src/redis-benchmark -u redis://$user:$pass@$host:$port]
set cmd [list src/placeholderkv-benchmark -u redis://$user:$pass@$host:$port]
lappend cmd {*}[redisbenchmark_tls_config "tests"]
lappend cmd {*}$opts
return $cmd
Expand Down
4 changes: 2 additions & 2 deletions tests/support/cli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ proc rediscli_tls_config {testsdir} {

# Returns command line for executing redis-cli
proc rediscli {host port {opts {}}} {
set cmd [list src/redis-cli -h $host -p $port]
set cmd [list src/placeholderkv-cli -h $host -p $port]
lappend cmd {*}[rediscli_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 {}}} {
return [list src/redis-cli -s $unixsocket {*}$opts]
return [list src/placeholderkv-cli -s $unixsocket {*}$opts]
}

# Run redis-cli with specified args on the server of specified level.
Expand Down
46 changes: 23 additions & 23 deletions tests/unit/cluster/cli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ start_multiple_servers 3 [list overrides $base_conf] {
set node3_rd [redis_deferring_client -2]

test {Create 3 node cluster} {
exec src/redis-cli --cluster-yes --cluster create \
exec src/placeholderkv-cli --cluster-yes --cluster create \
127.0.0.1:[srv 0 port] \
127.0.0.1:[srv -1 port] \
127.0.0.1:[srv -2 port]
Expand All @@ -47,7 +47,7 @@ start_multiple_servers 3 [list overrides $base_conf] {
}

test "Perform a Resharding" {
exec src/redis-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \
exec src/placeholderkv-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \
--cluster-to [$node1 cluster myid] \
--cluster-from [$node3 cluster myid] \
--cluster-slots 1
Expand All @@ -68,9 +68,9 @@ start_multiple_servers 3 [list overrides $base_conf] {
# waiting for cluster_state to be okay is an independent check that all the
# nodes actually believe each other are healthy, prevent cluster down error.
wait_for_condition 1000 50 {
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 &&
[CI 0 cluster_state] eq {ok} &&
[CI 1 cluster_state] eq {ok} &&
[CI 2 cluster_state] eq {ok}
Expand All @@ -92,8 +92,8 @@ start_multiple_servers 3 [list overrides $base_conf] {
assert_error "*MOVED $slot_for_foo :*" {$node1 set foo bar}

# when in cluster mode, redirect using previous hostip
assert_equal "[exec src/redis-cli -h 127.0.0.1 -p [srv 0 port] -c set foo bar]" {OK}
assert_match "[exec src/redis-cli -h 127.0.0.1 -p [srv 0 port] -c get foo]" {bar}
assert_equal "[exec src/placeholderkv-cli -h 127.0.0.1 -p [srv 0 port] -c set foo bar]" {OK}
assert_match "[exec src/placeholderkv-cli -h 127.0.0.1 -p [srv 0 port] -c get foo]" {bar}

assert_equal [$node1 CONFIG SET cluster-preferred-endpoint-type "$endpoint_type_before_set"] {OK}
}
Expand Down Expand Up @@ -164,7 +164,7 @@ start_multiple_servers 5 [list overrides $base_conf] {
set node5_rd [redis_client -4]

test {Functions are added to new node on redis-cli cluster add-node} {
exec src/redis-cli --cluster-yes --cluster create \
exec src/placeholderkv-cli --cluster-yes --cluster create \
127.0.0.1:[srv 0 port] \
127.0.0.1:[srv -1 port] \
127.0.0.1:[srv -2 port]
Expand All @@ -179,13 +179,13 @@ start_multiple_servers 5 [list overrides $base_conf] {
}

# upload a function to all the cluster
exec src/redis-cli --cluster-yes --cluster call 127.0.0.1:[srv 0 port] \
exec src/placeholderkv-cli --cluster-yes --cluster call 127.0.0.1:[srv 0 port] \
FUNCTION LOAD {#!lua name=TEST
redis.register_function('test', function() return 'hello' end)
}

# adding node to the cluster
exec src/redis-cli --cluster-yes --cluster add-node \
exec src/placeholderkv-cli --cluster-yes --cluster add-node \
127.0.0.1:[srv -3 port] \
127.0.0.1:[srv 0 port]

Expand Down Expand Up @@ -213,7 +213,7 @@ start_multiple_servers 5 [list overrides $base_conf] {

# adding node 5 to the cluster should failed because it already contains the 'test' function
catch {
exec src/redis-cli --cluster-yes --cluster add-node \
exec src/placeholderkv-cli --cluster-yes --cluster add-node \
127.0.0.1:[srv -4 port] \
127.0.0.1:[srv 0 port]
} e
Expand All @@ -227,7 +227,7 @@ test {Migrate the last slot away from a node using redis-cli} {
start_multiple_servers 4 [list overrides $base_conf] {

# Create a cluster of 3 nodes
exec src/redis-cli --cluster-yes --cluster create \
exec src/placeholderkv-cli --cluster-yes --cluster create \
127.0.0.1:[srv 0 port] \
127.0.0.1:[srv -1 port] \
127.0.0.1:[srv -2 port]
Expand All @@ -241,11 +241,11 @@ test {Migrate the last slot away from a node using redis-cli} {
}

# Insert some data
assert_equal OK [exec src/redis-cli -c -p [srv 0 port] SET foo bar]
set slot [exec src/redis-cli -c -p [srv 0 port] CLUSTER KEYSLOT foo]
assert_equal OK [exec src/placeholderkv-cli -c -p [srv 0 port] SET foo bar]
set slot [exec src/placeholderkv-cli -c -p [srv 0 port] CLUSTER KEYSLOT foo]

# Add new node to the cluster
exec src/redis-cli --cluster-yes --cluster add-node \
exec src/placeholderkv-cli --cluster-yes --cluster add-node \
127.0.0.1:[srv -3 port] \
127.0.0.1:[srv 0 port]

Expand Down Expand Up @@ -283,10 +283,10 @@ test {Migrate the last slot away from a node using redis-cli} {
# Using --cluster check make sure we won't get `Not all slots are covered by nodes`.
# Wait for the cluster to become stable make sure the cluster is up during MIGRATE.
wait_for_condition 1000 50 {
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -3 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -3 port]}] == 0 &&
[CI 0 cluster_state] eq {ok} &&
[CI 1 cluster_state] eq {ok} &&
[CI 2 cluster_state] eq {ok} &&
Expand All @@ -296,7 +296,7 @@ test {Migrate the last slot away from a node using redis-cli} {
}

# Move the only slot back to original node using redis-cli
exec src/redis-cli --cluster reshard 127.0.0.1:[srv -3 port] \
exec src/placeholderkv-cli --cluster reshard 127.0.0.1:[srv -3 port] \
--cluster-from $newnode_id \
--cluster-to $owner_id \
--cluster-slots 1 \
Expand Down Expand Up @@ -341,7 +341,7 @@ start_server [list overrides [list cluster-enabled yes cluster-node-timeout 1 cl
# The last two are used to test --cluster add-node

test "redis-cli -4 --cluster create using $ip_or_localhost with cluster-port" {
exec src/redis-cli -4 --cluster-yes --cluster create \
exec src/placeholderkv-cli -4 --cluster-yes --cluster create \
$ip_or_localhost:[srv 0 port] \
$ip_or_localhost:[srv -1 port] \
$ip_or_localhost:[srv -2 port]
Expand All @@ -362,7 +362,7 @@ start_server [list overrides [list cluster-enabled yes cluster-node-timeout 1 cl

test "redis-cli -4 --cluster add-node using $ip_or_localhost with cluster-port" {
# Adding node to the cluster (without cluster-port)
exec src/redis-cli -4 --cluster-yes --cluster add-node \
exec src/placeholderkv-cli -4 --cluster-yes --cluster add-node \
$ip_or_localhost:[srv -3 port] \
$ip_or_localhost:[srv 0 port]

Expand All @@ -378,7 +378,7 @@ start_server [list overrides [list cluster-enabled yes cluster-node-timeout 1 cl
}

# Adding node to the cluster (with cluster-port)
exec src/redis-cli -4 --cluster-yes --cluster add-node \
exec src/placeholderkv-cli -4 --cluster-yes --cluster add-node \
$ip_or_localhost:[srv -4 port] \
$ip_or_localhost:[srv 0 port]

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/moduleapi/cluster.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ start_cluster 3 0 [list config_lines $modules] {


test "Perform a Resharding" {
exec src/redis-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \
exec src/placeholderkv-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \
--cluster-to [$node1 cluster myid] \
--cluster-from [$node3 cluster myid] \
--cluster-slots 1
Expand All @@ -69,9 +69,9 @@ start_cluster 3 0 [list config_lines $modules] {

test "Wait for cluster to be stable" {
wait_for_condition 1000 50 {
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 &&
[catch {exec src/redis-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 &&
[catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 &&
[CI 0 cluster_state] eq {ok} &&
[CI 1 cluster_state] eq {ok} &&
[CI 2 cluster_state] eq {ok}
Expand Down

0 comments on commit 3586485

Please sign in to comment.