diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-04 17:58:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-04 17:58:41 +0000 |
commit | 7aaff451bafb4b43e1626b329e59a4c9aa7fc31d (patch) | |
tree | ef3363c81916814c65c92fbbfa49f5cb2be77bba /tests/unit/cluster | |
parent | Adding debian version 5:7.2.4-1. (diff) | |
download | redis-7aaff451bafb4b43e1626b329e59a4c9aa7fc31d.tar.xz redis-7aaff451bafb4b43e1626b329e59a4c9aa7fc31d.zip |
Merging upstream version 5:7.2.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/unit/cluster')
-rw-r--r-- | tests/unit/cluster/announced-endpoints.tcl | 18 | ||||
-rw-r--r-- | tests/unit/cluster/failure-marking.tcl | 53 |
2 files changed, 66 insertions, 5 deletions
diff --git a/tests/unit/cluster/announced-endpoints.tcl b/tests/unit/cluster/announced-endpoints.tcl index 941a8e0..becba22 100644 --- a/tests/unit/cluster/announced-endpoints.tcl +++ b/tests/unit/cluster/announced-endpoints.tcl @@ -1,8 +1,12 @@ start_cluster 2 2 {tags {external:skip cluster}} { test "Test change cluster-announce-port and cluster-announce-tls-port at runtime" { - set baseport [lindex [R 0 config get port] 1] - set count [expr [llength $::servers] +1 ] + if {$::tls} { + set baseport [lindex [R 0 config get tls-port] 1] + } else { + set baseport [lindex [R 0 config get port] 1] + } + set count [expr [llength $::servers] + 1] set used_port [find_available_port $baseport $count] R 0 config set cluster-announce-tls-port $used_port @@ -17,12 +21,16 @@ start_cluster 2 2 {tags {external:skip cluster}} { R 0 config set cluster-announce-tls-port 0 R 0 config set cluster-announce-port 0 - assert_match "*:$baseport@*" [R 0 CLUSTER NODES] + assert_match "*:$baseport@*" [R 0 CLUSTER NODES] } test "Test change cluster-announce-bus-port at runtime" { - set baseport [lindex [R 0 config get port] 1] - set count [expr [llength $::servers] +1 ] + if {$::tls} { + set baseport [lindex [R 0 config get tls-port] 1] + } else { + set baseport [lindex [R 0 config get port] 1] + } + set count [expr [llength $::servers] + 1] set used_port [find_available_port $baseport $count] # Verify config set cluster-announce-bus-port diff --git a/tests/unit/cluster/failure-marking.tcl b/tests/unit/cluster/failure-marking.tcl new file mode 100644 index 0000000..c4746c8 --- /dev/null +++ b/tests/unit/cluster/failure-marking.tcl @@ -0,0 +1,53 @@ +# Test a single primary can mark replica as `fail` +start_cluster 1 1 {tags {external:skip cluster}} { + + test "Verify that single primary marks replica as failed" { + set primary [srv -0 client] + + set replica1 [srv -1 client] + set replica1_pid [srv -1 pid] + set replica1_instance_id [dict get [cluster_get_myself 1] id] + + assert {[lindex [$primary role] 0] eq {master}} + assert {[lindex [$replica1 role] 0] eq {slave}} + + wait_for_sync $replica1 + + pause_process $replica1_pid + + wait_node_marked_fail 0 $replica1_instance_id + } +} + +# Test multiple primaries wait for a quorum and then mark a replica as `fail` +start_cluster 2 1 {tags {external:skip cluster}} { + + test "Verify that multiple primaries mark replica as failed" { + set primary1 [srv -0 client] + + set primary2 [srv -1 client] + set primary2_pid [srv -1 pid] + + set replica1 [srv -2 client] + set replica1_pid [srv -2 pid] + set replica1_instance_id [dict get [cluster_get_myself 2] id] + + assert {[lindex [$primary1 role] 0] eq {master}} + assert {[lindex [$primary2 role] 0] eq {master}} + assert {[lindex [$replica1 role] 0] eq {slave}} + + wait_for_sync $replica1 + + pause_process $replica1_pid + + # Pause other primary to allow time for pfail flag to appear + pause_process $primary2_pid + + wait_node_marked_pfail 0 $replica1_instance_id + + # Resume other primary and wait for to show replica as failed + resume_process $primary2_pid + + wait_node_marked_fail 0 $replica1_instance_id + } +} |