File 0003-Dev-behave-Adjust-functional-test-for-previous-chang.patch of Package crmsh
From 9d3c52b24438903d886e2f7be24d6e83731a308a Mon Sep 17 00:00:00 2001
From: xin liang <xliang@suse.com>
Date: Tue, 13 Aug 2024 21:44:37 +0800
Subject: [PATCH 3/4] Dev: behave: Adjust functional test for previous changes
---
test/features/bootstrap_sbd_delay.feature | 12 ++++++++----
test/features/bootstrap_sbd_normal.feature | 4 +++-
test/features/steps/step_implementation.py | 10 +++++-----
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/test/features/bootstrap_sbd_delay.feature b/test/features/bootstrap_sbd_delay.feature
index b8d1970c..3c3250c7 100644
--- a/test/features/bootstrap_sbd_delay.feature
+++ b/test/features/bootstrap_sbd_delay.feature
@@ -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"
@@ -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"
diff --git a/test/features/bootstrap_sbd_normal.feature b/test/features/bootstrap_sbd_normal.feature
index fe73377f..d5b2e456 100644
--- a/test/features/bootstrap_sbd_normal.feature
+++ b/test/features/bootstrap_sbd_normal.feature
@@ -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"
@@ -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"
diff --git a/test/features/steps/step_implementation.py b/test/features/steps/step_implementation.py
index d2d7d7ce..5c7d2312 100644
--- a/test/features/steps/step_implementation.py
+++ b/test/features/steps/step_implementation.py
@@ -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)
@@ -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
--
2.45.2