1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 06:48:07 +00:00

update centos version check test

Signed-off-by: bcambl <blayne@blaynecampbell.com>
This commit is contained in:
bcambl 2018-08-29 22:16:11 -06:00
parent 24b4aabae9
commit 6f8e8e98bb
2 changed files with 4 additions and 11 deletions

View File

@ -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

View File

@ -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