def test_ceph_report(): cr = CephReport(context_wrap(CEPH_REPORT)) ret = CephVersion(None, None, cr) assert ret.version == "3.2" assert ret.major == "3" assert ret.minor == "2" assert ret.downstream_release == "0" assert ret.upstream_version["release"] == 12 assert ret.upstream_version["major"] == 2 assert ret.upstream_version["minor"] == 8
def test_ceph_doc_examples(): env = { 'ceph_osd_dump': CephOsdDump(context_wrap(CEPH_OSD_DUMP_INFO)), 'ceph_osd_df': CephOsdDf(context_wrap(CEPH_OSD_DF_INFO)), 'ceph_s': CephS(context_wrap(CEPH_S_INFO)), 'ceph_df_detail': CephDfDetail(context_wrap(CEPH_DF_DETAIL_INFO)), 'ceph_health_detail': CephHealthDetail(context_wrap(CEPH_HEALTH_DETAIL_INFO)), 'ceph_osd_ec_profile_get': CephECProfileGet(context_wrap(CEPH_OSD_EC_PROFILE_GET)), 'ceph_cfg_info': CephCfgInfo(context_wrap(CEPHINFO)), 'ceph_osd_tree': CephOsdTree(context_wrap(CEPH_OSD_TREE)), 'ceph_report_content': CephReport(context_wrap(CEPH_REPORT)), } failed, total = doctest.testmod(ceph_cmd_json_parsing, globs=env) assert failed == 0
def test_invalid_empty(self): with pytest.raises(SkipException) as e: CephReport(context_wrap(CEPH_REPORT_EMPTY)) assert "Empty output." in str(e)
def test_invalid_json(self): with pytest.raises(ParseException) as e: CephReport(context_wrap(CEPH_REPORT_INVALID_JSON)) assert "Could not parse json." in str(e)
def test_invalid(self): with pytest.raises(ParseException) as e: CephReport(context_wrap(CEPH_REPORT_INVALID)) assert "Invalid" in str(e)
def test_ceph_report(self): result = CephReport(context_wrap(CEPH_REPORT)) assert result['version'] == "12.2.8-52.el7cp"