]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Add tests for rhel rpm dist detection 209/head
authorDavid Vossel <dvossel@redhat.com>
Mon, 30 Jun 2014 20:55:14 +0000 (16:55 -0400)
committerDavid Vossel <dvossel@redhat.com>
Fri, 4 Jul 2014 01:10:49 +0000 (20:10 -0500)
ceph_deploy/hosts/centos/__init__.py
ceph_deploy/tests/unit/hosts/test_centos.py

index c03ed635bb3a1cfd538b6418fc23b53f472fad6b..10259ad48714da07d4d60d513973329b3a17ea51 100644 (file)
@@ -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
index a7d93a625e58176393fac939b71507acfe5d566b..afb08f35e9361e52036c45fce155c7993bb61b6e 100644 (file)
@@ -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'