From 177c285330b692ef0bde5a2efffad90dfb8532ae Mon Sep 17 00:00:00 2001 From: nicholasyang Date: Tue, 16 Jul 2024 12:13:39 +0800 Subject: [PATCH] Dev: behave: adjust functional tests for previous commits --- test/features/qdevice_options.feature | 1 + test/features/qdevice_validate.feature | 2 +- test/features/steps/const.py | 2 +- test/features/steps/step_implementation.py | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/features/qdevice_options.feature b/test/features/qdevice_options.feature index e0277a7c2f..6d24b5963a 100644 --- a/test/features/qdevice_options.feature +++ b/test/features/qdevice_options.feature @@ -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 diff --git a/test/features/qdevice_validate.feature b/test/features/qdevice_validate.feature index 3309d9b012..1d38ea7283 100644 --- a/test/features/qdevice_validate.feature +++ b/test/features/qdevice_validate.feature @@ -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" diff --git a/test/features/steps/const.py b/test/features/steps/const.py index 6b5198da5f..8962aa6da4 100644 --- a/test/features/steps/const.py +++ b/test/features/steps/const.py @@ -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 diff --git a/test/features/steps/step_implementation.py b/test/features/steps/step_implementation.py index 724da75eca..d2d7d7ce92 100644 --- a/test/features/steps/step_implementation.py +++ b/test/features/steps/step_implementation.py @@ -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)