From 3e30944a189f440adfd274ec4ec9784acb986ea3 Mon Sep 17 00:00:00 2001 From: Shivshankar-Reddy Date: Wed, 10 Apr 2024 21:19:43 +0000 Subject: [PATCH] rename test proc to valkey Signed-off-by: Shivshankar-Reddy --- tests/cluster/cluster.tcl | 6 +++--- tests/cluster/tests/00-base.tcl | 4 ++-- tests/cluster/tests/03-failover-loop.tcl | 4 ++-- tests/cluster/tests/04-resharding.tcl | 14 +++++++------- tests/cluster/tests/07-replica-migration.tcl | 4 ++-- tests/cluster/tests/12-replica-migration-2.tcl | 4 ++-- tests/cluster/tests/12.1-replica-migration-3.tcl | 6 +++--- tests/cluster/tests/13-no-failover-option.tcl | 2 +- tests/cluster/tests/14-consistency-check.tcl | 2 +- tests/cluster/tests/includes/init-tests.tcl | 8 ++++---- tests/cluster/tests/includes/utils.tcl | 2 +- tests/instances.tcl | 16 ++++++++-------- tests/sentinel/tests/00-base.tcl | 2 +- tests/sentinel/tests/02-slaves-reconf.tcl | 4 ++-- tests/sentinel/tests/03-runtime-reconf.tcl | 8 ++++---- tests/sentinel/tests/05-manual.tcl | 2 +- tests/sentinel/tests/08-hostname-conf.tcl | 4 ++-- tests/sentinel/tests/10-replica-priority.tcl | 4 ++-- tests/sentinel/tests/12-master-reboot.tcl | 2 +- tests/sentinel/tests/includes/init-tests.tcl | 2 +- tests/support/redis.tcl | 6 +++--- tests/support/util.tcl | 2 +- tests/test_helper.tcl | 2 +- 23 files changed, 55 insertions(+), 55 deletions(-) diff --git a/tests/cluster/cluster.tcl b/tests/cluster/cluster.tcl index 83168f0918..708d718d6c 100644 --- a/tests/cluster/cluster.tcl +++ b/tests/cluster/cluster.tcl @@ -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 @@ -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] @@ -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} } } diff --git a/tests/cluster/tests/00-base.tcl b/tests/cluster/tests/00-base.tcl index 693dded1d8..cfb458fee0 100644 --- a/tests/cluster/tests/00-base.tcl +++ b/tests/cluster/tests/00-base.tcl @@ -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] @@ -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] diff --git a/tests/cluster/tests/03-failover-loop.tcl b/tests/cluster/tests/03-failover-loop.tcl index 46c22a9134..ea616be27e 100644 --- a/tests/cluster/tests/03-failover-loop.tcl +++ b/tests/cluster/tests/03-failover-loop.tcl @@ -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 @@ -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]} } } diff --git a/tests/cluster/tests/04-resharding.tcl b/tests/cluster/tests/04-resharding.tcl index e38b2bc6b5..d0db0dbfa6 100644 --- a/tests/cluster/tests/04-resharding.tcl +++ b/tests/cluster/tests/04-resharding.tcl @@ -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 @@ -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 @@ -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 @@ -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} } } diff --git a/tests/cluster/tests/07-replica-migration.tcl b/tests/cluster/tests/07-replica-migration.tcl index c4e998571b..05e378aade 100644 --- a/tests/cluster/tests/07-replica-migration.tcl +++ b/tests/cluster/tests/07-replica-migration.tcl @@ -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 @@ -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 { diff --git a/tests/cluster/tests/12-replica-migration-2.tcl b/tests/cluster/tests/12-replica-migration-2.tcl index 54681f96c1..73a679c780 100644 --- a/tests/cluster/tests/12-replica-migration-2.tcl +++ b/tests/cluster/tests/12-replica-migration-2.tcl @@ -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 @@ -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 } } diff --git a/tests/cluster/tests/12.1-replica-migration-3.tcl b/tests/cluster/tests/12.1-replica-migration-3.tcl index 86f4ac318a..218e137d95 100644 --- a/tests/cluster/tests/12.1-replica-migration-3.tcl +++ b/tests/cluster/tests/12.1-replica-migration-3.tcl @@ -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 @@ -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 } } @@ -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 diff --git a/tests/cluster/tests/13-no-failover-option.tcl b/tests/cluster/tests/13-no-failover-option.tcl index befa598d11..8fdbd8a744 100644 --- a/tests/cluster/tests/13-no-failover-option.tcl +++ b/tests/cluster/tests/13-no-failover-option.tcl @@ -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 { diff --git a/tests/cluster/tests/14-consistency-check.tcl b/tests/cluster/tests/14-consistency-check.tcl index e3b9a1918e..c70183f4e7 100644 --- a/tests/cluster/tests/14-consistency-check.tcl +++ b/tests/cluster/tests/14-consistency-check.tcl @@ -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 diff --git a/tests/cluster/tests/includes/init-tests.tcl b/tests/cluster/tests/includes/init-tests.tcl index 4875a01069..3ab5adcfdb 100644 --- a/tests/cluster/tests/includes/init-tests.tcl +++ b/tests/cluster/tests/includes/init-tests.tcl @@ -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) && @@ -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 { @@ -55,7 +55,7 @@ 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]] @@ -63,7 +63,7 @@ proc join_nodes_in_cluster {} { 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 { diff --git a/tests/cluster/tests/includes/utils.tcl b/tests/cluster/tests/includes/utils.tcl index dd477cce84..dc1bfe88d2 100644 --- a/tests/cluster/tests/includes/utils.tcl +++ b/tests/cluster/tests/includes/utils.tcl @@ -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 } } diff --git a/tests/instances.tcl b/tests/instances.tcl index 08f05aa55f..f69954a349 100644 --- a/tests/instances.tcl +++ b/tests/instances.tcl @@ -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 @@ -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" @@ -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 {} @@ -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. @@ -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 } @@ -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 diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index 7b64395081..177ece1480 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -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] diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 8196b60fac..1243da5b33 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -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 { @@ -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 diff --git a/tests/sentinel/tests/03-runtime-reconf.tcl b/tests/sentinel/tests/03-runtime-reconf.tcl index bd6eecc971..e2ac868103 100644 --- a/tests/sentinel/tests/03-runtime-reconf.tcl +++ b/tests/sentinel/tests/03-runtime-reconf.tcl @@ -6,7 +6,7 @@ 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] @@ -14,7 +14,7 @@ proc server_set_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 ""] } @@ -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 } @@ -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 } diff --git a/tests/sentinel/tests/05-manual.tcl b/tests/sentinel/tests/05-manual.tcl index 95e8d41e4e..27cb3eb193 100644 --- a/tests/sentinel/tests/05-manual.tcl +++ b/tests/sentinel/tests/05-manual.tcl @@ -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] diff --git a/tests/sentinel/tests/08-hostname-conf.tcl b/tests/sentinel/tests/08-hostname-conf.tcl index 263b06fca4..fde85f7dcf 100644 --- a/tests/sentinel/tests/08-hostname-conf.tcl +++ b/tests/sentinel/tests/08-hostname-conf.tcl @@ -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 } } @@ -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 } } diff --git a/tests/sentinel/tests/10-replica-priority.tcl b/tests/sentinel/tests/10-replica-priority.tcl index 17a59ed66a..d208c52c9e 100644 --- a/tests/sentinel/tests/10-replica-priority.tcl +++ b/tests/sentinel/tests/10-replica-priority.tcl @@ -1,7 +1,7 @@ source "../tests/includes/init-tests.tcl" test "Check acceptable replica-priority values" { - foreach_redis_id id { + foreach_valkey_id id { if {$id == $master_id} continue # ensure replica-announced accepts yes and no @@ -49,7 +49,7 @@ proc 10_test_number_of_replicas {n_replicas_expected} { proc 10_set_replica_announced {master_id announced n_replicas} { test "Set replica-announced=$announced on $n_replicas replicas" { set i 0 - foreach_redis_id id { + foreach_valkey_id id { if {$id == $master_id} continue #puts "set replica-announce=$announced on redis #$id" R $id CONFIG SET replica-announced "$announced" diff --git a/tests/sentinel/tests/12-master-reboot.tcl b/tests/sentinel/tests/12-master-reboot.tcl index 1fdd91d6a9..3271b2bd50 100644 --- a/tests/sentinel/tests/12-master-reboot.tcl +++ b/tests/sentinel/tests/12-master-reboot.tcl @@ -83,7 +83,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] diff --git a/tests/sentinel/tests/includes/init-tests.tcl b/tests/sentinel/tests/includes/init-tests.tcl index ddb1319033..73c8de71ed 100644 --- a/tests/sentinel/tests/includes/init-tests.tcl +++ b/tests/sentinel/tests/includes/init-tests.tcl @@ -13,7 +13,7 @@ test "(init) Remove old master entry from sentinels" { set redis_slaves [expr $::instances_count - 1] test "(init) Create a master-slaves cluster of [expr $redis_slaves+1] instances" { - create_redis_master_slave_cluster [expr {$redis_slaves+1}] + create_valkey_master_slave_cluster [expr {$redis_slaves+1}] } set master_id 0 diff --git a/tests/support/redis.tcl b/tests/support/redis.tcl index bc106ffd68..8025545065 100644 --- a/tests/support/redis.tcl +++ b/tests/support/redis.tcl @@ -265,7 +265,7 @@ proc ::redis::redis_readnl {fd len} { return $buf } -proc ::redis::redis_bulk_read {fd} { +proc ::redis::valkey_bulk_read {fd} { set count [redis_read_line $fd] if {$count == -1} return {} set buf [redis_readnl $fd $count] @@ -335,7 +335,7 @@ proc ::redis::redis_read_double {id fd} { } proc ::redis::redis_read_verbatim_str fd { - set v [redis_bulk_read $fd] + set v [valkey_bulk_read $fd] # strip the first 4 chars ("txt:") return [string range $v 4 end] } @@ -356,7 +356,7 @@ proc ::redis::redis_read_reply_logic {id fd} { # {return [redis_read_bool $fd]} = {return [redis_read_verbatim_str $fd]} - {return -code error [redis_read_line $fd]} - $ {return [redis_bulk_read $fd]} + $ {return [valkey_bulk_read $fd]} > - ~ - * {return [redis_multi_bulk_read $id $fd]} diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 6567abc657..51348bdc85 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -942,7 +942,7 @@ proc read_from_aof {fp} { set res {} for {set j 0} {$j < $count} {incr j} { read $fp 1 - set arg [::redis::redis_bulk_read $fp] + set arg [::redis::valkey_bulk_read $fp] if {$j == 0} {set arg [string tolower $arg]} lappend res $arg } diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index ff2620f6e8..e8d0fdc5cd 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -877,7 +877,7 @@ proc read_from_replication_stream {s} { set res {} for {set j 0} {$j < $count} {incr j} { read $s 1 - set arg [::redis::redis_bulk_read $s] + set arg [::redis::valkey_bulk_read $s] if {$j == 0} {set arg [string tolower $arg]} lappend res $arg }