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'
--- /dev/null
+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
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']
+