redict/tests/unit/cluster/announced-endpoints.tcl
DevineLiu 25ffa79b64
[BUG] Fix announced ports not updating on local node when updated at runtime (#10745)
The cluster-announce-port/cluster-announce-bus-port/cluster-announce-tls-port should take effect at runtime

Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2022-11-25 18:01:01 -08:00

43 lines
1.6 KiB
Tcl

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 ]
set used_port [find_available_port $baseport $count]
R 0 config set cluster-announce-tls-port $used_port
R 0 config set cluster-announce-port $used_port
assert_match "*:$used_port@*" [R 0 CLUSTER NODES]
wait_for_condition 50 100 {
[string match "*:$used_port@*" [R 1 CLUSTER NODES]]
} else {
fail "Cluster announced port was not propagated via gossip"
}
R 0 config set cluster-announce-tls-port 0
R 0 config set cluster-announce-port 0
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 ]
set used_port [find_available_port $baseport $count]
# Verify config set cluster-announce-bus-port
R 0 config set cluster-announce-bus-port $used_port
assert_match "*@$used_port *" [R 0 CLUSTER NODES]
wait_for_condition 50 100 {
[string match "*@$used_port *" [R 1 CLUSTER NODES]]
} else {
fail "Cluster announced port was not propagated via gossip"
}
# Verify restore default cluster-announce-port
set base_bus_port [expr $baseport + 10000]
R 0 config set cluster-announce-bus-port 0
assert_match "*@$base_bus_port *" [R 0 CLUSTER NODES]
}
}