]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Tests altlinux platform for pull request #472 475/head
authorAndrey Bychkov <mrdrew@altlinux.org>
Tue, 18 Dec 2018 07:01:51 +0000 (10:01 +0300)
committerAndrey Bychkov <mrdrew@altlinux.org>
Mon, 28 Jan 2019 12:04:55 +0000 (15:04 +0300)
ceph_deploy/tests/test_remotes.py
ceph_deploy/tests/unit/hosts/test_altlinux.py [new file with mode: 0644]
ceph_deploy/tests/unit/hosts/test_hosts.py
ceph_deploy/tests/unit/util/test_pkg_managers.py

index 4378ab75ea618e5b73b6d77af3415685efbb319e..4c7ac0369439d4c1717be0d8ced9555dfe0e51ff 100644 (file)
@@ -234,3 +234,22 @@ UBUNTU_CODENAME=xenial
         assert distro == 'ubuntu'
         assert release == '16.04'
         assert codename == 'xenial'
+
+    def test_handles_alt_8_2(self, tmpdir):
+        path = str(tmpdir.join('os_release'))
+        with open(path, 'w') as os_release:
+            os_release.write("""
+NAME="ALT"
+VERSION="8.2 "
+ID=altlinux
+VERSION_ID=8.2
+PRETTY_NAME="ALT Workstation K 8.2  (Centaurea Ruthenica)"
+ANSI_COLOR="1;33"
+CPE_NAME="cpe:/o:alt:kworkstation:8.2"
+HOME_URL="http://www.basealt.ru"
+BUG_REPORT_URL="https://bugs.altlinux.org/"
+""")
+        distro, release, codename = parse_os_release(path)
+        assert distro == 'altlinux'
+        assert release == '8.2'
+        assert codename == '8.2'
diff --git a/ceph_deploy/tests/unit/hosts/test_altlinux.py b/ceph_deploy/tests/unit/hosts/test_altlinux.py
new file mode 100644 (file)
index 0000000..d24dfc2
--- /dev/null
@@ -0,0 +1,11 @@
+from ceph_deploy.hosts.alt.install import map_components, NON_SPLIT_PACKAGES
+
+
+class TestALTMapComponents(object):
+    def test_valid(self):
+        pkgs = map_components(NON_SPLIT_PACKAGES, ['ceph-osd', 'ceph-common', 'ceph-radosgw'])
+        print(pkgs)
+        assert 'ceph' in pkgs
+        assert 'ceph-common' in pkgs
+        assert 'ceph-radosgw' in pkgs
+        assert 'ceph-osd' not in pkgs
index 60e98b7acee442bf06afb01452ed4c2914447824..dbc448c0380f4c7de06518de7baf219a93d98063 100644 (file)
@@ -427,3 +427,7 @@ class TestGetDistro(object):
     def test_get_arch(self):
         result = hosts._get_distro('Arch Linux')
         assert result.__name__.endswith('arch')
+
+    def test_get_altlinux(self):
+        result = hosts._get_distro('ALT Linux')
+        assert result.__name__.endswith('alt')
index 1e4cedc645eeb0780ef14d6bbb2a17fb5b1a2a51..5f06ad096db898540b233ebbfe747a1317fba985 100644 (file)
@@ -154,3 +154,42 @@ class TestDNF(object):
             pkg_managers.DNF(Mock()).remove(['vim', 'zsh'])
             result = fake_run.call_args_list[-1]
         assert 'remove' in result[0][-1]
+
+
+class TestAtpRpm(object):
+
+    def setup(self):
+        self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run'
+
+    def test_install_single_package(self):
+        fake_run = Mock()
+        with patch(self.to_patch, fake_run):
+            pkg_managers.AptRpm(Mock()).install('vim')
+            result = fake_run.call_args_list[-1]
+        assert 'install' in result[0][-1]
+        assert result[0][-1][-1] == 'vim'
+
+    def test_install_multiple_packages(self):
+        fake_run = Mock()
+        with patch(self.to_patch, fake_run):
+            pkg_managers.AptRpm(Mock()).install(['vim', 'zsh'])
+            result = fake_run.call_args_list[-1]
+        assert 'install' in result[0][-1]
+        assert result[0][-1][-2:] == ['vim', 'zsh']
+
+    def test_remove_single_package(self):
+        fake_run = Mock()
+        with patch(self.to_patch, fake_run):
+            pkg_managers.AptRpm(Mock()).remove('vim')
+            result = fake_run.call_args_list[-1]
+        assert 'remove' in result[0][-1]
+        assert result[0][-1][-1] == 'vim'
+
+    def test_remove_multiple_packages(self):
+        fake_run = Mock()
+        with patch(self.to_patch, fake_run):
+            pkg_managers.AptRpm(Mock()).remove(['vim', 'zsh'])
+            result = fake_run.call_args_list[-1]
+        assert 'remove' in result[0][-1]
+        assert result[0][-1][-2:] == ['vim', 'zsh']
+