From 55435a3137217271667b93932174f5cc34a575b5 Mon Sep 17 00:00:00 2001 From: mgoerens Date: Wed, 13 Sep 2023 11:45:08 +0200 Subject: [PATCH] Accept regex when checking for PR comment Signed-off-by: mgoerens --- .../HC-16_chart_test_takes_more_than_30mins.feature | 4 ++-- .../behave_features/common/utils/chart_certification.py | 3 ++- .../features/HC-16_chart_test_takes_more_than_30mins.feature | 2 +- tests/functional/utils/chart_certification.py | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/functional/behave_features/HC-16_chart_test_takes_more_than_30mins.feature b/tests/functional/behave_features/HC-16_chart_test_takes_more_than_30mins.feature index c32e199f..27973bec 100644 --- a/tests/functional/behave_features/HC-16_chart_test_takes_more_than_30mins.feature +++ b/tests/functional/behave_features/HC-16_chart_test_takes_more_than_30mins.feature @@ -10,8 +10,8 @@ Feature: Chart test takes longer time and exceeds default timeout @partners @full Examples: - | vendor_type | vendor | chart_path | message | - | partners | hashicorp | tests/data/vault-test-timeout-0.17.0.tgz | * timed out waiting for the condition | + | vendor_type | vendor | chart_path | message | + | partners | hashicorp | tests/data/vault-test-timeout-0.17.0.tgz | (timeout has expired\|timed out waiting for the condition) | @community @full Examples: diff --git a/tests/functional/behave_features/common/utils/chart_certification.py b/tests/functional/behave_features/common/utils/chart_certification.py index 74937cb7..9bde6d74 100644 --- a/tests/functional/behave_features/common/utils/chart_certification.py +++ b/tests/functional/behave_features/common/utils/chart_certification.py @@ -2,6 +2,7 @@ """Utility class for setting up and manipulating certification workflow tests.""" import os +import re import json import pathlib import shutil @@ -910,7 +911,7 @@ def check_pull_request_comments(self, expect_message: str): raise AssertionError(f"No comment found in the PR {self.secrets.pr_number}") complete_comment = response[0]["body"] - if expect_message in complete_comment: + if re.search(expect_message, complete_comment): logging.info("Found the expected comment in the PR") else: raise AssertionError( diff --git a/tests/functional/features/HC-16_chart_test_takes_more_than_30mins.feature b/tests/functional/features/HC-16_chart_test_takes_more_than_30mins.feature index 151f7990..f76e5c67 100644 --- a/tests/functional/features/HC-16_chart_test_takes_more_than_30mins.feature +++ b/tests/functional/features/HC-16_chart_test_takes_more_than_30mins.feature @@ -14,7 +14,7 @@ Feature: Chart test takes longer time and exceeds default timeout Examples: | vendor_type | vendor | message | - | partners | hashicorp | * timed out waiting for the condition | + | partners | hashicorp | (timeout has expired\|timed out waiting for the condition) | | community | redhat | Community charts require maintainer review and approval, a review will be conducted shortly | Scenario Outline: [HC-16-002] A redhat associate submits a chart that takes more than 30 mins diff --git a/tests/functional/utils/chart_certification.py b/tests/functional/utils/chart_certification.py index 5d52c035..920b2410 100644 --- a/tests/functional/utils/chart_certification.py +++ b/tests/functional/utils/chart_certification.py @@ -2,6 +2,7 @@ """Utility class for setting up and manipulating certification workflow tests.""" import os +import re import json import pathlib import shutil @@ -818,7 +819,7 @@ def check_pull_request_comments(self, expect_message: str): response = json.loads(r.text) complete_comment = response[0]["body"] - if expect_message in complete_comment: + if re.search(expect_message, complete_comment): logging.info("Found the expected comment in the PR") else: pytest.fail(