Skip to content

Commit 0f71e08

Browse files
committed
Test: cts-fencing: Test pcmk_delay_base/pcmk_delay_max properly
Commit f057778 fixed an off-by-one error that a test relied on to avoid randomness in the output. Also add a new test to ensure that pcmk_delay_base is capped by pcmk_delay_max. Signed-off-by: Reid Wahl <[email protected]>
1 parent 5c590f6 commit 0f71e08

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

cts/cts-fencing.in

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,21 +510,28 @@ class FenceTests(Tests):
510510
args='--output-as=xml -R true1 -a fence_dummy -o mode=pass -o "pcmk_host_list=node1 node2 node3" -o pcmk_delay_base=1')
511511
test.add_cmd("stonith_admin",
512512
args='--output-as=xml -R false1 -a fence_dummy -o mode=fail -o "pcmk_host_list=node1 node2 node3" -o pcmk_delay_base=1')
513-
# Resulting "random" delay will always be 1 since (rand() % (delay_max - delay_base)) is always 0 here
513+
514+
# Resulting "random" delay will be either 1 or 2 seconds
514515
test.add_cmd("stonith_admin",
515516
args='--output-as=xml -R true2 -a fence_dummy -o mode=pass -o "pcmk_host_list=node1 node2 node3" -o pcmk_delay_base=1 -o pcmk_delay_max=2')
517+
518+
# Resulting delay will be 1 second (capped by pcmk_delay_max)
516519
test.add_cmd("stonith_admin",
517-
args='--output-as=xml -R true3 -a fence_dummy -o mode=pass -o "pcmk_host_list=node1 node2 node3"')
520+
args='--output-as=xml -R true3 -a fence_dummy -o mode=pass -o "pcmk_host_list=node1 node2 node3" -o pcmk_delay_base=2 -o pcmk_delay_max=1')
521+
522+
test.add_cmd("stonith_admin",
523+
args='--output-as=xml -R true4 -a fence_dummy -o mode=pass -o "pcmk_host_list=node1 node2 node3"')
518524

519525
test.add_cmd("stonith_admin", args="--output-as=xml -r node3 -i 1 -v true1")
520526
test.add_cmd("stonith_admin", args="--output-as=xml -r node3 -i 1 -v false1")
521527
test.add_cmd("stonith_admin", args="--output-as=xml -r node3 -i 2 -v true2")
522528
test.add_cmd("stonith_admin", args="--output-as=xml -r node3 -i 2 -v true3")
529+
test.add_cmd("stonith_admin", args="--output-as=xml -r node3 -i 2 -v true4")
523530

524531
test.add_cmd("stonith_admin", args="--output-as=xml -F node3 --delay 1")
525532

526533
# Total fencing timeout takes all fencing delays into account
527-
test.add_log_pattern("Total timeout set to 582s")
534+
test.add_log_pattern("Total timeout set to 727s")
528535

529536
# Fencing timeout for the first device takes the requested fencing delay
530537
# and pcmk_delay_base into account
@@ -543,9 +550,15 @@ class FenceTests(Tests):
543550
# Fencing timeout takes pcmk_delay_max into account
544551
test.add_log_pattern(r"Requesting that .* perform 'off' action targeting node3 using true2 .*146s.*",
545552
regex=True)
546-
test.add_log_pattern("Delaying 'off' action targeting node3 using true2 for 1s | timeout=120s requested_delay=0s base=1s max=2s")
553+
test.add_log_pattern(r"Delaying 'off' action targeting node3 using true2 for [12]s "
554+
"| timeout=120s requested_delay=0s base=1s max=2s",
555+
regex=True)
556+
test.add_log_pattern(r"Requesting that .* perform 'off' action targeting node3 using true3 .*145s.*",
557+
regex=True)
558+
test.add_log_pattern("Delaying 'off' action targeting node3 using true3 for 1s "
559+
"| timeout=120s requested_delay=0s base=1s max=1s")
547560

548-
test.add_log_pattern("Delaying 'off' action targeting node3 using true3",
561+
test.add_log_pattern("Delaying 'off' action targeting node3 using true4",
549562
negative=True)
550563

551564
def build_unfence_tests(self):

0 commit comments

Comments
 (0)