Skip to content

Commit

Permalink
Add check to verify deprecated envar message
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Diblik <[email protected]>
  • Loading branch information
danmyway committed Nov 7, 2024
1 parent 2f31e3c commit aa964c4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import re
from tests.integration.test_helpers.common_functions import get_log_file_data

log_file_data = get_log_file_data()


def test_verify_initramfs_and_vmlinuz_present(log_file_data):
Expand Down
24 changes: 22 additions & 2 deletions tests/integration/test_helpers/common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def get_custom_repos_names():
return repos


@pytest.fixture()
def log_file_data():
def get_log_file_data():
"""
Helper fixture.
Reads and returns data from the convert2rhel.log file.
Expand All @@ -125,3 +124,24 @@ def log_file_data():
log_data = logfile.read()

return log_data


@pytest.fixture(autouse=True)
def check_validate_deprecated_envar_message():
"""
Check fixture.
Validate that the warning message for deprecated environment variables is present,
if the respective environment variable is used.
"""

yield

log_file_data = get_log_file_data()

missing_envar_messages = []
for key in os.environ.keys():
if re.match("CONVERT2RHEL_", key):
if not re.search(f"The environment variable {key} is deprecated", log_file_data):
missing_envar_messages.append(key)
if missing_envar_messages:
pytest.fail(f"The warning message for deprecated envars {missing_envar_messages} is not not present.")

0 comments on commit aa964c4

Please sign in to comment.