From 6f8e8e98bbc4db871e14ed4a44c8ff7756c35121 Mon Sep 17 00:00:00 2001 From: bcambl Date: Wed, 29 Aug 2018 22:16:11 -0600 Subject: [PATCH] update centos version check test Signed-off-by: bcambl --- automated install/basic-install.sh | 2 +- test/test_centos_fedora_support.py | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 6b8274be..53a01b9d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -257,7 +257,7 @@ elif command -v rpm &> /dev/null; then CURRENT_CENTOS_VERSION=$(grep -oP '(?<= )[0-9]+(?=\.)' /etc/redhat-release) # Check if CentOS version is supported if [[ $CURRENT_CENTOS_VERSION -lt $SUPPORTED_CENTOS_VERSION ]]; then - echo -e " ${CROSS} CentOS $CURRENT_CENTOS_VERSION is not suported." + echo -e " ${CROSS} CentOS $CURRENT_CENTOS_VERSION is not supported." echo -e " Please update to CentOS release $SUPPORTED_CENTOS_VERSION or later" # exit the installer exit diff --git a/test/test_centos_fedora_support.py b/test/test_centos_fedora_support.py index 8318e44a..df53d73f 100644 --- a/test/test_centos_fedora_support.py +++ b/test/test_centos_fedora_support.py @@ -31,20 +31,13 @@ def test_release_supported_version_check_centos(Pihole): ''' confirms installer exits on unsupported releases of CentOS ''' - # mock CentOS release < 7 (unsupported) - mock_command_2( - 'rpm', - {"-q --queryformat '%{VERSION}' centos-release'": ( - '5', - '0' - )}, - Pihole - ) + # modify /etc/redhat-release to mock an unsupported CentOS release + Pihole.run('echo "CentOS Linux release 6.9" > /etc/redhat-release') distro_check = Pihole.run(''' source /opt/pihole/basic-install.sh distro_check ''') - expected_stdout = cross_box + (' CentOS is not suported.') + expected_stdout = cross_box + (' CentOS 6 is not supported.') assert expected_stdout in distro_check.stdout expected_stdout = 'Please update to CentOS release 7 or later' assert expected_stdout in distro_check.stdout