From 569037e1c5a9e18949646b2bf0cc98a10b0ea05b Mon Sep 17 00:00:00 2001 From: LukeShirnia Date: Mon, 29 Apr 2024 17:23:07 +0100 Subject: [PATCH] Fix tests for amazonlinux by installing rsyslog --- Dockerfile | 3 ++- tests/test_system.py | 2 +- tests/test_validate_options.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 82a0972..306a0f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ ARG PIP ARG PYTHON_VERSION RUN if echo ${IMAGE} | grep -q "amazon"; then \ - yum update -y && yum install -y python3-pip; \ + # Amazon Linux doesn't have rsyslog installed by default + yum update -y && yum install -y python3-pip rsyslog; \ elif echo ${IMAGE} | grep -q "centos"; then \ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py && \ python get-pip.py; \ diff --git a/tests/test_system.py b/tests/test_system.py index 3ceb6a3..40d9ef4 100644 --- a/tests/test_system.py +++ b/tests/test_system.py @@ -52,7 +52,7 @@ def test_file_processing(self, capsys): out, _ = capsys.readouterr() assert "Using Log File: \x1b[0m\x1b[1;32mtests/assets/logs/messages" in out - assert "OOM Incidents: \x1b[0m\x1b[1;31m19\x1b[0m\n" in out + assert "OOM Incidents: \x1b[0m\x1b[1;31m19\x1b[0m" in out assert "OOM Incident: \x1b[0m\x1b[0;96m19\x1b[0m" in out assert "Displaying all OOM incidents:" in out diff --git a/tests/test_validate_options.py b/tests/test_validate_options.py index 598a1e6..cc37232 100644 --- a/tests/test_validate_options.py +++ b/tests/test_validate_options.py @@ -32,7 +32,7 @@ class TestSystem: # Skip tests on Amazon Linux and CentOS because they don't have dmesg @pytest.mark.skipif( - System().get_distro_info()[0] in ["amzn", "centos"], + System().get_distro_info()[0] in ["centos"], reason="No dmesg in arch container", ) def test_dmesg(self, capsys):