From 03d66e666cf4a5a003932e0f6e4cac8b9e38552f Mon Sep 17 00:00:00 2001 From: nicholasyang Date: Tue, 16 Jul 2024 13:25:42 +0800 Subject: [PATCH] fixup! Dev: behave: adjust functional tests for previous commits --- test/features/qdevice_validate.feature | 1 + test/features/steps/step_implementation.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/test/features/qdevice_validate.feature b/test/features/qdevice_validate.feature index 3309d9b012..6ed7491b11 100644 --- a/test/features/qdevice_validate.feature +++ b/test/features/qdevice_validate.feature @@ -85,6 +85,7 @@ Feature: corosync qdevice/qnetd options validate 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/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)