Skip to content

Commit

Permalink
Dev: behave: adjust functional tests for previous commits
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyang2022 committed Jul 16, 2024
1 parent b420cb6 commit 177c285
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/features/qdevice_options.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Feature: corosync qdevice/qnetd options
When Run "crm cluster init --qnetd-hostname=qnetd-node --qdevice-tls=off -y" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
And Service "corosync-qnetd" is "started" on "qnetd-node"
And Show corosync qdevice configuration

@clean
Expand Down
2 changes: 1 addition & 1 deletion test/features/qdevice_validate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Feature: corosync qdevice/qnetd options validate
When Run "crm cluster init -n cluster1 -y" on "hanode3"
Then Cluster service is "started" on "hanode3"
When Try "crm cluster init qdevice --qnetd-hostname=qnetd-node -y" on "hanode2,hanode3"
Then Except "ERROR: cluster.init: Duplicated cluster name "cluster1"!"
Then Expected regex "(?:Duplicated cluster name|cluster's name .* already exists)" in stderr
When Run "crm cluster stop" on "hanode2"
When Run "crm cluster stop" on "hanode3"

Expand Down
2 changes: 1 addition & 1 deletion test/features/steps/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
--qdevice-tie-breaker TIE_BREAKER
QNetd TIE_BREAKER (lowest/highest/valid_node_id,
default:lowest)
--qdevice-tls TLS Whether using TLS on QDevice/QNetd (on/off/required,
--qdevice-tls TLS Whether using TLS on QDevice (on/off/required,
default:on)
--qdevice-heuristics COMMAND
COMMAND to run with absolute path. For multiple
Expand Down
6 changes: 6 additions & 0 deletions test/features/steps/step_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def step_impl(context, reg_str):
context.stdout = None


@then('Expected regex "{reg_str}" in stderr')
def step_impl(context, reg_str):
assert context.stderr is not None and re.search(reg_str, context.stderr)
context.stderr = None


@then('Expected return code is "{num}"')
def step_impl(context, num):
assert context.return_code == int(num)
Expand Down

0 comments on commit 177c285

Please sign in to comment.