Skip to content

Commit

Permalink
Dev: behave: Adjust functional test for previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Aug 20, 2024
1 parent 41e9511 commit 667ca8a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
12 changes: 8 additions & 4 deletions test/features/bootstrap_sbd_delay.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ Feature: configure sbd delay start correctly
And SBD option "SBD_DELAY_START" value is "no"
And SBD option "SBD_WATCHDOG_TIMEOUT" value is "15"
And SBD option "msgwait" value for "/dev/sda1" is "30"
# calculated and set by sbd RA
And Cluster property "stonith-timeout" is "43"
# original value is 43, which is calculated by external/sbd RA
# now fence_sbd doesn't calculate it, so this value is the default one
# from pacemaker
And Cluster property "stonith-timeout" is "60"
And Parameter "pcmk_delay_max" not configured in "stonith-sbd"

Given Has disk "/dev/sda1" on "hanode2"
Expand Down Expand Up @@ -112,8 +114,10 @@ Feature: configure sbd delay start correctly
And SBD option "SBD_DELAY_START" value is "no"
And SBD option "SBD_WATCHDOG_TIMEOUT" value is "60"
And SBD option "msgwait" value for "/dev/sda1" is "120"
# calculated and set by sbd RA
And Cluster property "stonith-timeout" is "172"
# original value is 172, which is calculated by external/sbd RA
# now fence_sbd doesn't calculate it, so this value is the default one
# from pacemaker
And Cluster property "stonith-timeout" is "60"
And Parameter "pcmk_delay_max" not configured in "stonith-sbd"

Given Has disk "/dev/sda1" on "hanode2"
Expand Down
4 changes: 3 additions & 1 deletion test/features/bootstrap_sbd_normal.feature
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Feature: crmsh bootstrap sbd management
And Online nodes are "hanode1 hanode2"
When Run "crm configure primitive d Dummy op monitor interval=3s" on "hanode1"
When Run "crm cluster init sbd -s /dev/sda1 -y" on "hanode1"
Then Expected "WARNING: To start sbd.service, need to restart cluster service manually on each node" in stderr
Then Expected "WARNING: Resource is running, need to restart cluster service manually on each node" in stderr
Then Service "sbd" is "stopped" on "hanode1"
And Service "sbd" is "stopped" on "hanode2"
When Run "crm cluster restart" on "hanode1"
Expand Down Expand Up @@ -263,6 +263,8 @@ Feature: crmsh bootstrap sbd management
And Resource "stonith-sbd" type "fence_sbd" is "Started"
And Run "ps -ef|grep -v grep|grep 'watcher: /dev/sda1 '" OK

When Try "crm cluster init sbd -s /dev/sda2 -y"
Then Except "ERROR: cluster.init: Can't configure stage sbd: sbd.service already running! Please use crm option '-F' if need to redeploy"
When Run "crm -F cluster init sbd -s /dev/sda2 -y" on "hanode1"
Then Service "sbd" is "started" on "hanode1"
And Service "sbd" is "started" on "hanode2"
Expand Down
10 changes: 5 additions & 5 deletions test/features/steps/step_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def step_impl(context, res_id, node):

@then('SBD option "{key}" value is "{value}"')
def step_impl(context, key, value):
res = sbd.SBDManager.get_sbd_value_from_config(key)
res = sbd.SBDUtils.get_sbd_value_from_config(key)
assert_eq(value, res)


Expand All @@ -453,27 +453,27 @@ def step_impl(context, key, dev, value):
def step_impl(context, key, value):
res = crmutils.get_property(key)
assert res is not None
assert_eq(value, str(res))
assert_eq(value.strip('s'), str(res).strip('s'))


@then('Property "{key}" in "{type}" is "{value}"')
def step_impl(context, key, type, value):
res = crmutils.get_property(key, type)
assert res is not None
assert_eq(value, str(res))
assert_eq(value.strip('s'), str(res).strip('s'))


@then('Parameter "{param_name}" not configured in "{res_id}"')
def step_impl(context, param_name, res_id):
_, out, _ = run_command(context, "crm configure show {}".format(res_id))
result = re.search("params {}=".format(param_name), out)
result = re.search("params .*{}=".format(param_name), out)
assert result is None


@then('Parameter "{param_name}" configured in "{res_id}"')
def step_impl(context, param_name, res_id):
_, out, _ = run_command(context, "crm configure show {}".format(res_id))
result = re.search("params {}=".format(param_name), out)
result = re.search("params .*{}=".format(param_name), out)
assert result is not None


Expand Down

0 comments on commit 667ca8a

Please sign in to comment.