From: David Vossel Date: Mon, 30 Jun 2014 20:55:14 +0000 (-0400) Subject: Add tests for rhel rpm dist detection X-Git-Tag: v1.5.8~6^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=171462aace7857c2cf9faac24b28cc10a7aa60ee;p=ceph-deploy.git Add tests for rhel rpm dist detection --- diff --git a/ceph_deploy/hosts/centos/__init__.py b/ceph_deploy/hosts/centos/__init__.py index c03ed63..10259ad 100644 --- a/ceph_deploy/hosts/centos/__init__.py +++ b/ceph_deploy/hosts/centos/__init__.py @@ -1,6 +1,6 @@ import mon # noqa import pkg # noqa -from install import install, mirror_install, repo_install, repository_url_part # noqa +from install import install, mirror_install, repo_install, repository_url_part, rpm_dist # noqa from uninstall import uninstall # noqa # Allow to set some information about this distro diff --git a/ceph_deploy/tests/unit/hosts/test_centos.py b/ceph_deploy/tests/unit/hosts/test_centos.py index a7d93a6..afb08f3 100644 --- a/ceph_deploy/tests/unit/hosts/test_centos.py +++ b/ceph_deploy/tests/unit/hosts/test_centos.py @@ -1,8 +1,7 @@ from ceph_deploy.hosts import centos from mock import Mock - -class TestCentosUrlPart(object): +class TestCentosVersionDetection(object): def setup(self): self.distro = Mock() @@ -23,3 +22,18 @@ class TestCentosUrlPart(object): self.distro.normalized_name = 'redhat' self.distro.release = '7.0' assert centos.repository_url_part(self.distro) == 'rhel7' + + def test_rpm_dist_fallsback_to_el6(self): + self.distro.normalized_name = 'redhat' + self.distro.release = '3' + assert centos.rpm_dist(self.distro) == 'el6' + + def test_rpm_dist_detects_rhel6(self): + self.distro.normalized_name = 'redhat' + self.distro.release = '6.6' + assert centos.rpm_dist(self.distro) == 'el6' + + def test_rpm_dist_detects_rhel7(self): + self.distro.normalized_name = 'redhat' + self.distro.release = '7.0' + assert centos.rpm_dist(self.distro) == 'el7'