Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'primary' instead of 'master' in Sentinel tcl testing. #724

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/sentinel/tests/00-base.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test "SENTINEL PENDING-SCRIPTS returns the information about pending scripts" {
assert_morethan_equal [llength [S 0 SENTINEL PENDING-SCRIPTS]] 0
}

test "SENTINEL MASTERS returns a list of monitored masters" {
test "SENTINEL PRIMARIES returns a list of monitored primaries" {
assert_match "*mymaster*" [S 0 SENTINEL MASTERS]
assert_morethan_equal [llength [S 0 SENTINEL MASTERS]] 1
}
Expand All @@ -75,7 +75,7 @@ test "SENTINEL SIMULATE-FAILURE HELP list supported flags" {
assert_equal {crash-after-election crash-after-promotion} $res
}

test "Basic failover works if the master is down" {
test "Basic failover works if the primary is down" {
set old_port [RPort $master_id]
set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
Expand All @@ -94,11 +94,11 @@ test "Basic failover works if the master is down" {
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
}

test "New master [join $addr {:}] role matches" {
test "New primary [join $addr {:}] role matches" {
assert {[RI $master_id role] eq {master}}
}

test "All the other slaves now point to the new master" {
test "All the other slaves now point to the new primary" {
foreach_valkey_id id {
if {$id != $master_id && $id != 0} {
wait_for_condition 1000 50 {
Expand All @@ -110,7 +110,7 @@ test "All the other slaves now point to the new master" {
}
}

test "The old master eventually gets reconfigured as a slave" {
test "The old primary eventually gets reconfigured as a slave" {
wait_for_condition 1000 50 {
[RI 0 master_port] == [lindex $addr 1]
} else {
Expand Down Expand Up @@ -190,12 +190,12 @@ test "Failover works if we configure for absolute agreement" {
}
}

test "New master [join $addr {:}] role matches" {
test "New primary [join $addr {:}] role matches" {
assert {[RI $master_id role] eq {master}}
}

test "SENTINEL RESET can resets the master" {
# After SENTINEL RESET, sometimes the sentinel can sense the master again,
test "SENTINEL RESET can resets the primary" {
# After SENTINEL RESET, sometimes the sentinel can sense the primary again,
# causing the test to fail. Here we give it a few more chances.
for {set j 0} {$j < 10} {incr j} {
assert_equal 1 [S 0 SENTINEL RESET mymaster]
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/01-conf-update.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test "After Sentinel 1 is restarted, its config gets updated" {
}
}

test "New master [join $addr {:}] role matches" {
test "New primary [join $addr {:}] role matches" {
assert {[RI $master_id role] eq {master}}
}

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 @@ -9,7 +9,7 @@ source "../tests/includes/init-tests.tcl"

proc 02_test_slaves_replication {} {
uplevel 1 {
test "Check that slaves replicate from current master" {
test "Check that slaves replicate from current primary" {
set master_port [RPort $master_id]
foreach_valkey_id id {
if {$id == $master_id} continue
Expand All @@ -27,7 +27,7 @@ proc 02_test_slaves_replication {} {

proc 02_crash_and_failover {} {
uplevel 1 {
test "Crash the master and force a failover" {
test "Crash the primary and force a failover" {
set old_port [RPort $master_id]
set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
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 @@ -63,11 +63,11 @@ proc wait_for_sentinels_connect_servers { {is_connect 1} } {
}
}

test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" {
test "Sentinels (re)connection following SENTINEL SET myprimary auth-pass" {
# 3 types of sentinels to test:
# (re)started while master changed pwd. Manage to connect only after setting pwd
# (re)started while primary changed pwd. Manage to connect only after setting pwd
set sent2re 0
# (up)dated in advance with master new password
# (up)dated in advance with primary new password
set sent2up 1
# (un)touched. Yet manage to maintain (old) connection
set sent2un 2
Expand Down Expand Up @@ -98,7 +98,7 @@ test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" {
verify_sentinel_auto_discovery
}

test "Sentinels (re)connection following master ACL change" {
test "Sentinels (re)connection following primary ACL change" {
# Three types of sentinels to test during ACL change:
# 1. (re)started Sentinel. Manage to connect only after setting new pwd
# 2. (up)dated Sentinel, get just before ACL change the new password
Expand Down
6 changes: 3 additions & 3 deletions tests/sentinel/tests/05-manual.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ test "Manual failover works" {
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
}

test "New master [join $addr {:}] role matches" {
test "New primary [join $addr {:}] role matches" {
assert {[RI $master_id role] eq {master}}
}

test "All the other slaves now point to the new master" {
test "All the other slaves now point to the new primary" {
foreach_valkey_id id {
if {$id != $master_id && $id != 0} {
wait_for_condition 1000 50 {
Expand All @@ -54,7 +54,7 @@ test "All the other slaves now point to the new master" {
}
}

test "The old master eventually gets reconfigured as a slave" {
test "The old primary eventually gets reconfigured as a slave" {
wait_for_condition 1000 50 {
[RI 0 master_port] == [lindex $addr 1]
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/07-down-conditions.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test "SDOWN is triggered by crashed instance" {
ensure_master_up
}

test "SDOWN is triggered by masters advertising as slaves" {
test "SDOWN is triggered by primaries advertising as slaves" {
ensure_master_up
R 0 slaveof 127.0.0.1 34567
ensure_master_down
Expand Down
8 changes: 4 additions & 4 deletions tests/sentinel/tests/12-master-reboot.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ proc reboot_instance {type id} {
}


test "Master reboot in very short time" {
test "Primary reboot in very short time" {
set old_port [RPort $master_id]
set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
Expand Down Expand Up @@ -78,11 +78,11 @@ test "Master reboot in very short time" {
}
}

test "New master [join $addr {:}] role matches" {
test "New primary [join $addr {:}] role matches" {
assert {[RI $master_id role] eq {master}}
}

test "All the other slaves now point to the new master" {
test "All the other slaves now point to the new primary" {
foreach_valkey_id id {
if {$id != $master_id && $id != 0} {
wait_for_condition 1000 50 {
Expand All @@ -94,7 +94,7 @@ test "All the other slaves now point to the new master" {
}
}

test "The old master eventually gets reconfigured as a slave" {
test "The old primary eventually gets reconfigured as a slave" {
wait_for_condition 1000 50 {
[RI 0 master_port] == [lindex $addr 1]
} else {
Expand Down
8 changes: 4 additions & 4 deletions tests/sentinel/tests/includes/init-tests.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ test "(init) Restart killed instances" {
restart_killed_instances
}

test "(init) Remove old master entry from sentinels" {
test "(init) Remove old primary entry from sentinels" {
foreach_sentinel_id id {
catch {S $id SENTINEL REMOVE mymaster}
}
}

set redis_slaves [expr $::instances_count - 1]
test "(init) Create a master-slaves cluster of [expr $redis_slaves+1] instances" {
test "(init) Create a primary-slaves cluster of [expr $redis_slaves+1] instances" {
create_valkey_master_slave_cluster [expr {$redis_slaves+1}]
}
set master_id 0

test "(init) Sentinels can start monitoring a master" {
test "(init) Sentinels can start monitoring a primary" {
set sentinels [llength $::sentinel_instances]
set quorum [expr {$sentinels/2+1}]
foreach_sentinel_id id {
Expand All @@ -38,7 +38,7 @@ test "(init) Sentinels can start monitoring a master" {
}
}

test "(init) Sentinels can talk with the master" {
test "(init) Sentinels can talk with the primary" {
foreach_sentinel_id id {
wait_for_condition 1000 50 {
[catch {S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster}] == 0
Expand Down
Loading