From 3abdec9969b85fd28ddfa1fbe9730172f5b78b68 Mon Sep 17 00:00:00 2001 From: Madelyn Olson <34459052+madolson@users.noreply.github.com> Date: Sat, 16 Jul 2022 23:57:34 -0700 Subject: [PATCH] Fix cluster hostnames test causing failover while running valgrind (#10991) In the newly added cluster hostnames test, the primary is failing over during the reboot for valgrind so we are validating the wrong node. This change just sets the replica to prevent taking over, which seems to fix the test. We could have also set the timeout higher, but it slows down the test. --- tests/unit/cluster/hostnames.tcl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/cluster/hostnames.tcl b/tests/unit/cluster/hostnames.tcl index f9fd3f719..124ceb643 100644 --- a/tests/unit/cluster/hostnames.tcl +++ b/tests/unit/cluster/hostnames.tcl @@ -203,8 +203,14 @@ test "Verify the nodes configured with prefer hostname only show hostname for ne test "Test restart will keep hostname information" { # Set a new hostname, reboot and make sure it sticks R 0 config set cluster-announce-hostname "restart-1.com" + # Store the hostname in the config R 0 config rewrite + + # If the primary is slow to reboot it might get demoted, so prevent the replica + # from nominating itself. + R 3 config set cluster-replica-no-failover yes + restart_server 0 true false set slot_result [R 0 CLUSTER SLOTS] assert_equal [lindex [get_slot_field $slot_result 0 2 3] 1] "restart-1.com"