def test_all_ceph_versions_same_raise_error_on_unknown_rc( self, log, subprocess_check_output): call_exception = utils.subprocess.CalledProcessError( 0, mock.MagicMock() ) subprocess_check_output.side_effect = call_exception with self.assertRaises(utils.OsdPostUpgradeError): utils._all_ceph_versions_same()
def test_all_ceph_versions_same_cmd_not_found( self, log, subprocess_check_output): call_exception = utils.subprocess.CalledProcessError( 22, mock.MagicMock() ) subprocess_check_output.side_effect = call_exception return_bool = utils._all_ceph_versions_same() self.assertFalse(return_bool)
def test_all_ceph_versions_same_one_overall_no_osd_returns_false( self, log, json_loads, subprocess_check_output): mock_versions_dict = dict( osd=dict(), overall=dict(version_1=1) ) json_loads.return_value = mock_versions_dict return_bool = utils._all_ceph_versions_same() self.assertFalse( return_bool, msg='all_ceph_versions_same returned True but should be False') log.assert_called_once()