Skip to content

Commit

Permalink
rename test proc to valkey
Browse files Browse the repository at this point in the history
Signed-off-by: Shivshankar-Reddy <[email protected]>
  • Loading branch information
Shivshankar-Reddy committed Apr 10, 2024
1 parent f8cec23 commit 3e30944
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 55 deletions.
6 changes: 3 additions & 3 deletions tests/cluster/cluster.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ proc cluster_allocate_slots {n} {

# Check that cluster nodes agree about "state", or raise an error.
proc assert_cluster_state {state} {
foreach_redis_id id {
foreach_valkey_id id {
if {[instance_is_killed redis $id]} continue
wait_for_condition 1000 50 {
[CI $id cluster_state] eq $state
Expand All @@ -99,7 +99,7 @@ proc assert_cluster_state {state} {
# Search the first node starting from ID $first that is not
# already configured as a slave.
proc cluster_find_available_slave {first} {
foreach_redis_id id {
foreach_valkey_id id {
if {$id < $first} continue
if {[instance_is_killed redis $id]} continue
set me [get_myself $id]
Expand Down Expand Up @@ -161,7 +161,7 @@ proc cluster_create_with_continuous_slots {masters slaves} {

# Set the cluster node-timeout to all the reachalbe nodes.
proc set_cluster_node_timeout {to} {
foreach_redis_id id {
foreach_valkey_id id {
catch {R $id CONFIG SET cluster-node-timeout $to}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/cluster/tests/00-base.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if {$::simulate_error} {
test "Different nodes have different IDs" {
set ids {}
set numnodes 0
foreach_redis_id id {
foreach_valkey_id id {
incr numnodes
# Every node should just know itself.
set nodeid [dict get [get_myself $id] id]
Expand All @@ -31,7 +31,7 @@ test "After the join, every node gets a different config epoch" {
while {[incr trynum -1] != 0} {
# We check that this condition is true for *all* the nodes.
set ok 1 ; # Will be set to 0 every time a node is not ok.
foreach_redis_id id {
foreach_valkey_id id {
set epochs {}
foreach n [get_cluster_nodes $id] {
lappend epochs [dict get $n config_epoch]
Expand Down
4 changes: 2 additions & 2 deletions tests/cluster/tests/03-failover-loop.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ while {[incr iterations -1]} {
if {$role eq {master}} {
set slave {}
set myid [dict get [get_myself $tokill] id]
foreach_redis_id id {
foreach_valkey_id id {
if {$id == $tokill} continue
if {[dict get [get_myself $id] slaveof] eq $myid} {
set slave $id
Expand Down Expand Up @@ -111,7 +111,7 @@ while {[incr iterations -1]} {
}

test "Post condition: current_epoch >= my_epoch everywhere" {
foreach_redis_id id {
foreach_valkey_id id {
assert {[CI $id cluster_current_epoch] >= [CI $id cluster_my_epoch]}
}
}
14 changes: 7 additions & 7 deletions tests/cluster/tests/04-resharding.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ test "Cluster is up" {
}

test "Enable AOF in all the instances" {
foreach_redis_id id {
foreach_valkey_id id {
R $id config set appendonly yes
# We use "appendfsync no" because it's fast but also guarantees that
# write(2) is performed before replying to client.
R $id config set appendfsync no
}

foreach_redis_id id {
foreach_valkey_id id {
wait_for_condition 1000 500 {
[RI $id aof_rewrite_in_progress] == 0 &&
[RI $id aof_enabled] == 1
Expand Down Expand Up @@ -138,7 +138,7 @@ test "Verify $numkeys keys for consistency with logical content" {
}

test "Terminate and restart all the instances" {
foreach_redis_id id {
foreach_valkey_id id {
# Stop AOF so that an initial AOFRW won't prevent the instance from terminating
R $id config set appendonly no
kill_instance redis $id
Expand All @@ -160,20 +160,20 @@ test "Verify $numkeys keys after the restart" {
}

test "Disable AOF in all the instances" {
foreach_redis_id id {
foreach_valkey_id id {
R $id config set appendonly no
}
}

test "Verify slaves consistency" {
set verified_masters 0
foreach_redis_id id {
foreach_valkey_id id {
set role [R $id role]
lassign $role myrole myoffset slaves
if {$myrole eq {slave}} continue
set masterport [get_instance_attrib redis $id port]
set masterdigest [R $id debug digest]
foreach_redis_id sid {
foreach_valkey_id sid {
set srole [R $sid role]
if {[lindex $srole 0] eq {master}} continue
if {[lindex $srole 2] != $masterport} continue
Expand All @@ -190,7 +190,7 @@ test "Verify slaves consistency" {

test "Dump sanitization was skipped for migrations" {
set verified_masters 0
foreach_redis_id id {
foreach_valkey_id id {
assert {[RI $id dump_payload_sanitizations] == 0}
}
}
4 changes: 2 additions & 2 deletions tests/cluster/tests/07-replica-migration.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test "Cluster is up" {
}

test "Each master should have two replicas attached" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id < 5} {
wait_for_condition 1000 50 {
[llength [lindex [R $id role] 2]] == 2
Expand All @@ -34,7 +34,7 @@ test "Killing all the slaves of master #0 and #1" {
after 4000
}

foreach_redis_id id {
foreach_valkey_id id {
if {$id < 5} {
test "Master #$id should have at least one replica" {
wait_for_condition 1000 50 {
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 @@ -18,7 +18,7 @@ test "Cluster is up" {
}

test "Each master should have at least two replicas attached" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id < 5} {
wait_for_condition 1000 50 {
[llength [lindex [R $id role] 2]] >= 2
Expand All @@ -30,7 +30,7 @@ test "Each master should have at least two replicas attached" {
}

test "Set allow-replica-migration yes" {
foreach_redis_id id {
foreach_valkey_id id {
R $id CONFIG SET cluster-allow-replica-migration yes
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/cluster/tests/12.1-replica-migration-3.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test "Cluster is up" {
}

test "Each master should have at least two replicas attached" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id < 5} {
wait_for_condition 1000 50 {
[llength [lindex [R $id role] 2]] >= 2
Expand All @@ -29,7 +29,7 @@ test "Each master should have at least two replicas attached" {
}

test "Set allow-replica-migration no" {
foreach_redis_id id {
foreach_valkey_id id {
R $id CONFIG SET cluster-allow-replica-migration no
}
}
Expand All @@ -52,7 +52,7 @@ test "Master #0 still should have its replicas" {
}

test "Each master should have at least two replicas attached" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id < 5} {
wait_for_condition 1000 50 {
[llength [lindex [R $id role] 2]] >= 2
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/13-no-failover-option.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test "Instance #5 synced with the master" {
test "The nofailover flag is propagated" {
set slave5_id [dict get [get_myself 5] id]

foreach_redis_id id {
foreach_valkey_id id {
wait_for_condition 1000 50 {
[has_flag [get_node_by_id $id $slave5_id] nofailover]
} else {
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 @@ -15,7 +15,7 @@ test "Cluster is writable" {

proc find_non_empty_master {} {
set master_id_no {}
foreach_redis_id id {
foreach_valkey_id id {
if {[RI $id role] eq {master} && [R $id dbsize] > 0} {
set master_id_no $id
break
Expand Down
8 changes: 4 additions & 4 deletions tests/cluster/tests/includes/init-tests.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test "(init) Restart killed instances" {
}

test "Cluster nodes are reachable" {
foreach_redis_id id {
foreach_valkey_id id {
# Every node should be reachable.
wait_for_condition 1000 50 {
([catch {R $id ping} ping_reply] == 0) &&
Expand All @@ -26,7 +26,7 @@ test "Cluster nodes are reachable" {
}

test "Cluster nodes hard reset" {
foreach_redis_id id {
foreach_valkey_id id {
if {$::valgrind} {
set node_timeout 10000
} else {
Expand Down Expand Up @@ -55,15 +55,15 @@ proc join_nodes_in_cluster {} {
# If auto-discovery works all nodes will know every other node
# eventually.
set ids {}
foreach_redis_id id {lappend ids $id}
foreach_valkey_id id {lappend ids $id}
for {set j 0} {$j < [expr [llength $ids]-1]} {incr j} {
set a [lindex $ids $j]
set b [lindex $ids [expr $j+1]]
set b_port [get_instance_attrib redis $b port]
R $a cluster meet 127.0.0.1 $b_port
}

foreach_redis_id id {
foreach_valkey_id id {
wait_for_condition 1000 50 {
[llength [get_cluster_nodes $id connected]] == [llength $ids]
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/includes/utils.tcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "../../../tests/support/cli.tcl"

proc config_set_all_nodes {keyword value} {
foreach_redis_id id {
foreach_valkey_id id {
R $id config set $keyword $value
}
}
Expand Down
16 changes: 8 additions & 8 deletions tests/instances.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set ::dont_clean 0
set ::simulate_error 0
set ::failed 0
set ::sentinel_instances {}
set ::redis_instances {}
set ::valkey_instances {}
set ::global_config {}
set ::sentinel_base_port 20000
set ::redis_base_port 30000
Expand Down Expand Up @@ -345,7 +345,7 @@ proc pause_on_error {} {
} elseif {$cmd eq {show-redis-logs}} {
set count 10
if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]}
foreach_redis_id id {
foreach_valkey_id id {
puts "=== REDIS $id ===="
puts [exec tail -$count redis_$id/log.txt]
puts "---------------------\n"
Expand All @@ -359,7 +359,7 @@ proc pause_on_error {} {
puts "---------------------\n"
}
} elseif {$cmd eq {ls}} {
foreach_redis_id id {
foreach_valkey_id id {
puts -nonewline "Redis $id"
set errcode [catch {
set str {}
Expand Down Expand Up @@ -530,7 +530,7 @@ proc S {n args} {
# Example:
# [Rn 0] info
proc Rn {n} {
return [dict get [lindex $::redis_instances $n] link]
return [dict get [lindex $::valkey_instances $n] link]
}

# Like R but to chat with server instances.
Expand Down Expand Up @@ -588,8 +588,8 @@ proc foreach_sentinel_id {idvar code} {
return -code $errcode $result
}

proc foreach_redis_id {idvar code} {
set errcode [catch {uplevel 1 [list foreach_instance_id $::redis_instances $idvar $code]} result]
proc foreach_valkey_id {idvar code} {
set errcode [catch {uplevel 1 [list foreach_instance_id $::valkey_instances $idvar $code]} result]
return -code $errcode $result
}

Expand All @@ -608,8 +608,8 @@ proc set_instance_attrib {type id attrib newval} {
# Create a master-slave cluster of the given number of total instances.
# The first instance "0" is the master, all others are configured as
# slaves.
proc create_redis_master_slave_cluster n {
foreach_redis_id id {
proc create_valkey_master_slave_cluster n {
foreach_valkey_id id {
if {$id == 0} {
# Our master.
R $id slaveof no one
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/00-base.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ test "New master [join $addr {:}] role matches" {
}

test "All the other slaves now point to the new master" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id != $master_id && $id != 0} {
wait_for_condition 1000 50 {
[RI $id master_port] == [lindex $addr 1]
Expand Down
4 changes: 2 additions & 2 deletions tests/sentinel/tests/02-slaves-reconf.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ proc 02_test_slaves_replication {} {
uplevel 1 {
test "Check that slaves replicate from current master" {
set master_port [RPort $master_id]
foreach_redis_id id {
foreach_valkey_id id {
if {$id == $master_id} continue
if {[instance_is_killed redis $id]} continue
wait_for_condition 1000 50 {
Expand Down Expand Up @@ -58,7 +58,7 @@ foreach_sentinel_id id {
02_test_slaves_replication

test "Kill a slave instance" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id == $master_id} continue
set killed_slave_id $id
kill_instance redis $id
Expand Down
8 changes: 4 additions & 4 deletions tests/sentinel/tests/03-runtime-reconf.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ set ::user "testuser"
set ::password "secret"

proc server_set_password {} {
foreach_redis_id id {
foreach_valkey_id id {
assert_equal {OK} [R $id CONFIG SET requirepass $::password]
assert_equal {OK} [R $id AUTH $::password]
assert_equal {OK} [R $id CONFIG SET masterauth $::password]
}
}

proc server_reset_password {} {
foreach_redis_id id {
foreach_valkey_id id {
assert_equal {OK} [R $id CONFIG SET requirepass ""]
assert_equal {OK} [R $id CONFIG SET masterauth ""]
}
Expand Down Expand Up @@ -116,7 +116,7 @@ test "Sentinels (re)connection following master ACL change" {
assert_equal {OK} [S $sent2up SENTINEL SET mymaster auth-user $::user]
assert_equal {OK} [S $sent2up SENTINEL SET mymaster auth-pass $::password]

foreach_redis_id id {
foreach_valkey_id id {
server_set_acl $id
}

Expand Down Expand Up @@ -153,7 +153,7 @@ test "Sentinels (re)connection following master ACL change" {
wait_for_sentinels_connect_servers

# remove requirepass and verify sentinels manage to connect servers
foreach_redis_id id {
foreach_valkey_id id {
server_reset_acl $id
}

Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/05-manual.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test "New master [join $addr {:}] role matches" {
}

test "All the other slaves now point to the new master" {
foreach_redis_id id {
foreach_valkey_id id {
if {$id != $master_id && $id != 0} {
wait_for_condition 1000 50 {
[RI $id master_port] == [lindex $addr 1]
Expand Down
4 changes: 2 additions & 2 deletions tests/sentinel/tests/08-hostname-conf.tcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "../tests/includes/utils.tcl"

proc set_redis_announce_ip {addr} {
foreach_redis_id id {
foreach_valkey_id id {
R $id config set replica-announce-ip $addr
}
}
Expand All @@ -16,7 +16,7 @@ proc set_all_instances_hostname {hostname} {
foreach_sentinel_id id {
set_instance_attrib sentinel $id host $hostname
}
foreach_redis_id id {
foreach_valkey_id id {
set_instance_attrib redis $id host $hostname
}
}
Expand Down
Loading

0 comments on commit 3e30944

Please sign in to comment.