From: Vasu Kulkarni Date: Tue, 6 Sep 2016 21:07:33 +0000 (-0700) Subject: unit tests for install function X-Git-Tag: 1.1.0~496^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2a8d3728ee27a7b48c97f3feed9d011a50fbece4;p=teuthology.git unit tests for install function Signed-off-by: Vasu Kulkarni --- diff --git a/teuthology/test/task/test_install.py b/teuthology/test/task/test_install.py index 34345eaf8b..a772b5f582 100644 --- a/teuthology/test/task/test_install.py +++ b/teuthology/test/task/test_install.py @@ -264,3 +264,36 @@ class TestInstall(object): }, } assert install.upgrade_remote_to_config(ctx, config) == expected_config + + + @patch("teuthology.task.install.packaging.get_package_version") + @patch("teuthology.task.install.redhat.set_deb_repo") + def test_rh_install_deb_pkgs(self, m_set_rh_deb_repo, m_get_pkg_version): + ctx = Mock() + remote = Mock() + version = '1.3.2' + rh_ds_yaml = dict() + rh_ds_yaml = {'versions': {'deb': {'mapped': {'1.3.2': '0.94.5'}}}, + 'pkgs': { 'deb': ['pkg1', 'pkg2'] }} + m_get_pkg_version.return_value = "0.94.5" + deb_repo=Mock() + deb_gpg_key=Mock() + install.redhat.install_deb_pkgs(ctx, remote, version, rh_ds_yaml, + deb_repo, deb_gpg_key) + + + @patch("teuthology.task.install.packaging.get_package_version") + def test_rh_install_pkgs(self, m_get_pkg_version): + ctx = Mock() + remote = Mock() + version = '1.3.2' + rh_ds_yaml = dict() + rh_ds_yaml = {'versions': {'rpm': {'mapped': {'1.3.2': '0.94.5', + '1.3.1': '0.94.3'}}}, + 'pkgs': { 'rpm': ['pkg1', 'pkg2'] }} + m_get_pkg_version.return_value = "0.94.5" + install.redhat.install_pkgs(ctx, remote, version, rh_ds_yaml) + version = '1.3.1' + with pytest.raises(RuntimeError) as e: + install.redhat.install_pkgs(ctx, remote, version, rh_ds_yaml) + assert "Version check failed" in str(e)