Skip to content

Commit

Permalink
Rename remaining test procedures (valkey-io#355)
Browse files Browse the repository at this point in the history
Renamed below procedures and variables (missed in valkey-io#287) as follows.

redis_cluster             ->     valkey_cluster
redis1                    ->     valkey1
redis2                    ->     valkey2
get_redis_dir             ->     get_valkey_dir
test_redis_cli_rdb_dump   ->     test_valkey_cli_rdb_dump
test_redis_cli_repl       ->     test_valkey_cli_repl
redis-cli                 ->     valkey-cli
redis_reset_state         ->     valkey_reset_state
redisHandle               ->     valkeyHandle
redis_safe_read           ->     valkey_safe_read
redis_safe_gets           ->     valkey_safe_gets
redis_write               ->     valkey_write
redis_read_reply          ->     valkey_read_reply
redis_readable            ->     valkey_readable
redis_readnl              ->     valkey_readnl
redis_writenl             ->     valkey_writenl
redis_read_map            ->     valkey_read_map
redis_read_line           ->     valkey_read_line
redis_read_null           ->     valkey_read_null
redis_read_bool           ->     valkey_read_bool
redis_read_double         ->     valkey_read_double
redis_read_verbatim_str   ->     valkey_read_verbatim_str
redis_call_callback       ->     valkey_call_callback

---------

Signed-off-by: Shivshankar-Reddy <[email protected]>

Signed-off-by: Sher Sun <[email protected]>
  • Loading branch information
Shivshankar-Reddy authored and Sher Sun committed Apr 26, 2024
1 parent d09a59c commit 8f202d2
Show file tree
Hide file tree
Showing 19 changed files with 188 additions and 188 deletions.
2 changes: 1 addition & 1 deletion tests/cluster/cluster.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ proc set_cluster_node_timeout {to} {
proc cluster_write_test {id} {
set prefix [randstring 20 20 alpha]
set port [get_instance_attrib valkey $id port]
set cluster [redis_cluster 127.0.0.1:$port]
set cluster [valkey_cluster 127.0.0.1:$port]
for {set j 0} {$j < 100} {incr j} {
$cluster set key.$j $prefix.$j
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/03-failover-loop.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test "Cluster is up" {
}

set iterations 20
set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]

while {[incr iterations -1]} {
set tokill [randomInt 10]
Expand Down
4 changes: 2 additions & 2 deletions tests/cluster/tests/04-resharding.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ proc process_is_running {pid} {
set numkeys 50000
set numops 200000
set start_node_port [get_instance_attrib valkey 0 port]
set cluster [redis_cluster 127.0.0.1:$start_node_port]
set cluster [valkey_cluster 127.0.0.1:$start_node_port]
if {$::tls} {
# setup a non-TLS cluster client to the TLS cluster
set plaintext_port [get_instance_attrib valkey 0 plaintext-port]
set cluster_plaintext [redis_cluster 127.0.0.1:$plaintext_port 0]
set cluster_plaintext [valkey_cluster 127.0.0.1:$plaintext_port 0]
puts "Testing TLS cluster on start node 127.0.0.1:$start_node_port, plaintext port $plaintext_port"
} else {
set cluster_plaintext $cluster
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/05-slave-selection.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test "Instance #5 and #10 synced with the master" {
}
}

set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]

test "Slaves are both able to receive and acknowledge writes" {
for {set j 0} {$j < 100} {incr j} {
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/10-manual-failover.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set current_epoch [CI 1 cluster_current_epoch]

set numkeys 50000
set numops 10000
set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
catch {unset content}
array set content {}

Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/14-consistency-check.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ proc get_one_of_my_replica {id} {
proc cluster_write_keys_with_expire {id ttl} {
set prefix [randstring 20 20 alpha]
set port [get_instance_attrib valkey $id port]
set cluster [redis_cluster 127.0.0.1:$port]
set cluster [valkey_cluster 127.0.0.1:$port]
for {set j 100} {$j < 200} {incr j} {
$cluster setex key_expire.$j $ttl $prefix.$j
}
Expand Down
6 changes: 3 additions & 3 deletions tests/cluster/tests/15-cluster-slots.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ test "client do not break when cluster slot" {
}

test "client can handle keys with hash tag" {
set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
$cluster set foo{tag} bar
$cluster close
}

test "slot migration is valid from primary to another primary" {
set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set key order1
set slot [$cluster cluster keyslot $key]
array set nodefrom [$cluster masternode_for_slot $slot]
Expand All @@ -61,7 +61,7 @@ test "slot migration is valid from primary to another primary" {
}

test "slot migration is invalid from primary to replica" {
set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set key order1
set slot [$cluster cluster keyslot $key]
array set nodefrom [$cluster masternode_for_slot $slot]
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/20-half-migrated-slot.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test "Cluster is up" {
assert_cluster_state ok
}

set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
catch {unset nodefrom}
catch {unset nodeto}

Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/21-many-slot-migration.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test "Cluster is up" {
assert_cluster_state ok
}

set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
catch {unset nodefrom}
catch {unset nodeto}

Expand Down
4 changes: 2 additions & 2 deletions tests/cluster/tests/25-pubsubshard-slot-migration.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ test "Cluster is up" {
assert_cluster_state ok
}

set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]

proc get_addr_replica_serving_slot slot {
set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
array set node [$cluster masternode_for_slot $slot]

set replicanodeinfo [$cluster cluster replicas $node(id)]
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/26-pubsubshard.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test "Create a 3 nodes cluster" {
cluster_create_with_continuous_slots 3 3
}

set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
test "Pub/Sub shard basics" {

set slot [$cluster cluster keyslot "channel.0"]
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/29-slot-migration-response.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test "Cluster is up" {
assert_cluster_state ok
}

set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]]
catch {unset nodefrom}
catch {unset nodeto}

Expand Down
4 changes: 2 additions & 2 deletions tests/cluster/tests/includes/utils.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ proc fix_cluster {addr} {
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"
puts "valkey-cli --cluster fix returns non-zero exit code, output below:\n$result"
}
# Note: valkey-cli --cluster fix may return a non-zero exit code if nodes don't agree,
# 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 {*}[valkeycli_tls_config "../../../tests"] --cluster check $addr} result] == 0
} else {
puts "redis-cli --cluster check returns non-zero exit code, output below:\n$result"
puts "valkey-cli --cluster check returns non-zero exit code, output below:\n$result"
fail "Cluster could not settle with configuration"
}
}
Expand Down
62 changes: 31 additions & 31 deletions tests/integration/aof-multi-part.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -604,71 +604,71 @@ tags {"external:skip"} {
}

start_server_aof [list dir $server_path] {
set redis1 [valkey [srv host] [srv port] 0 $::tls]
set valkey1 [valkey [srv host] [srv port] 0 $::tls]

start_server [list overrides [list dir $server_path appendonly yes appendfilename appendonly.aof2]] {
set redis2 [valkey [srv host] [srv port] 0 $::tls]
set valkey2 [valkey [srv host] [srv port] 0 $::tls]

test "Multi Part AOF can upgrade when when two servers share the same server dir (server1)" {
wait_done_loading $redis1
assert_equal v1 [$redis1 get k1]
assert_equal v2 [$redis1 get k2]
assert_equal v3 [$redis1 get k3]
wait_done_loading $valkey1
assert_equal v1 [$valkey1 get k1]
assert_equal v2 [$valkey1 get k2]
assert_equal v3 [$valkey1 get k3]

assert_equal 0 [$redis1 exists k4]
assert_equal 0 [$redis1 exists k5]
assert_equal 0 [$redis1 exists k6]
assert_equal 0 [$valkey1 exists k4]
assert_equal 0 [$valkey1 exists k5]
assert_equal 0 [$valkey1 exists k6]

assert_aof_manifest_content $aof_manifest_file {
{file appendonly.aof seq 1 type b}
{file appendonly.aof.1.incr.aof seq 1 type i}
}

$redis1 bgrewriteaof
waitForBgrewriteaof $redis1
$valkey1 bgrewriteaof
waitForBgrewriteaof $valkey1

assert_equal OK [$redis1 set k v]
assert_equal OK [$valkey1 set k v]

assert_aof_manifest_content $aof_manifest_file {
{file appendonly.aof.2.base.rdb seq 2 type b}
{file appendonly.aof.2.incr.aof seq 2 type i}
}

set d1 [$redis1 debug digest]
$redis1 debug loadaof
set d2 [$redis1 debug digest]
set d1 [$valkey1 debug digest]
$valkey1 debug loadaof
set d2 [$valkey1 debug digest]
assert {$d1 eq $d2}
}

test "Multi Part AOF can upgrade when when two servers share the same server dir (server2)" {
wait_done_loading $redis2
wait_done_loading $valkey2

assert_equal 0 [$redis2 exists k1]
assert_equal 0 [$redis2 exists k2]
assert_equal 0 [$redis2 exists k3]
assert_equal 0 [$valkey2 exists k1]
assert_equal 0 [$valkey2 exists k2]
assert_equal 0 [$valkey2 exists k3]

assert_equal v4 [$redis2 get k4]
assert_equal v5 [$redis2 get k5]
assert_equal v6 [$redis2 get k6]
assert_equal v4 [$valkey2 get k4]
assert_equal v5 [$valkey2 get k5]
assert_equal v6 [$valkey2 get k6]

assert_aof_manifest_content $aof_manifest_file2 {
{file appendonly.aof2 seq 1 type b}
{file appendonly.aof2.1.incr.aof seq 1 type i}
}

$redis2 bgrewriteaof
waitForBgrewriteaof $redis2
$valkey2 bgrewriteaof
waitForBgrewriteaof $valkey2

assert_equal OK [$redis2 set k v]
assert_equal OK [$valkey2 set k v]

assert_aof_manifest_content $aof_manifest_file2 {
{file appendonly.aof2.2.base.rdb seq 2 type b}
{file appendonly.aof2.2.incr.aof seq 2 type i}
}

set d1 [$redis2 debug digest]
$redis2 debug loadaof
set d2 [$redis2 debug digest]
set d1 [$valkey2 debug digest]
$valkey2 debug loadaof
set d2 [$valkey2 debug digest]
assert {$d1 eq $d2}
}
}
Expand All @@ -677,7 +677,7 @@ tags {"external:skip"} {

test {Multi Part AOF can handle appendfilename contains whitespaces} {
start_server [list overrides [list appendonly yes appendfilename "\" file seq \\n\\n.aof \""]] {
set dir [get_redis_dir]
set dir [get_valkey_dir]
set aof_manifest_name [format "%s/%s/%s%s" $dir "appendonlydir" " file seq \n\n.aof " $::manifest_suffix]
set valkey [valkey [srv host] [srv port] 0 $::tls]

Expand Down Expand Up @@ -756,7 +756,7 @@ tags {"external:skip"} {


start_server {tags {"Multi Part AOF"} overrides {aof-use-rdb-preamble {yes} appendonly {no} save {}}} {
set dir [get_redis_dir]
set dir [get_valkey_dir]
set aof_basename "appendonly.aof"
set aof_dirname "appendonlydir"
set aof_dirpath "$dir/$aof_dirname"
Expand Down Expand Up @@ -1174,7 +1174,7 @@ tags {"external:skip"} {
}

start_server {overrides {aof-use-rdb-preamble {yes} appendonly {no} save {}}} {
set dir [get_redis_dir]
set dir [get_valkey_dir]
set aof_basename "appendonly.aof"
set aof_dirname "appendonlydir"
set aof_dirpath "$dir/$aof_dirname"
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/valkey-cli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
r acl deluser clitest
}
proc test_redis_cli_rdb_dump {functions_only} {
proc test_valkey_cli_rdb_dump {functions_only} {
r flushdb
r function flush
Expand Down Expand Up @@ -480,12 +480,12 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
test "Dumping an RDB - functions only: $functions_only" {
# Disk-based master
assert_match "OK" [r config set repl-diskless-sync no]
test_redis_cli_rdb_dump $functions_only
test_valkey_cli_rdb_dump $functions_only
# Disk-less master
assert_match "OK" [r config set repl-diskless-sync yes]
assert_match "OK" [r config set repl-diskless-sync-delay 0]
test_redis_cli_rdb_dump $functions_only
test_valkey_cli_rdb_dump $functions_only
} {} {needs:repl needs:debug}
} ;# foreach functions_only
Expand All @@ -504,12 +504,12 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
assert_equal {key:2} [run_cli --scan --quoted-pattern {"*:\x32"}]
}
proc test_redis_cli_repl {} {
proc test_valkey_cli_repl {} {
set fd [open_cli "--replica"]
wait_for_condition 500 100 {
[string match {*slave0:*state=online*} [r info]]
} else {
fail "redis-cli --replica did not connect"
fail "valkey-cli --replica did not connect"
}
for {set i 0} {$i < 100} {incr i} {
Expand All @@ -519,7 +519,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
wait_for_condition 500 100 {
[string match {*test-value-99*} [read_cli $fd]]
} else {
fail "redis-cli --replica didn't read commands"
fail "valkey-cli --replica didn't read commands"
}
fconfigure $fd -blocking true
Expand All @@ -531,12 +531,12 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS
test "Connecting as a replica" {
# Disk-based master
assert_match "OK" [r config set repl-diskless-sync no]
test_redis_cli_repl
test_valkey_cli_repl
# Disk-less master
assert_match "OK" [r config set repl-diskless-sync yes]
assert_match "OK" [r config set repl-diskless-sync-delay 0]
test_redis_cli_repl
test_valkey_cli_repl
} {} {needs:repl}
test "Piping raw protocol" {
Expand Down
2 changes: 1 addition & 1 deletion tests/support/aofmanifest.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ proc join_path {dir1 dir2} {
return [format "%s/%s" $dir1 $dir2]
}

proc get_redis_dir {} {
proc get_valkey_dir {} {
set config [srv config]
set _ [dict get $config "dir"]
}
Expand Down
Loading

0 comments on commit 8f202d2

Please sign in to comment.