def test_014_verify_SB_get_status_after_cluster_stop(self): """Validate SB get_status while cluster is down.""" cmd = "pcs cluster stop --all" cmd_proc = SimpleProcess(cmd) _, _, rc = cmd_proc.run() self.assertEqual(rc, 0) bundle_obj = SupportBundle.generate( comment=TestSupportBundle.sb_description, components=['csm']) time.sleep(15) tar_file_name = f"{bundle_obj.bundle_id}_"\ f"{TestSupportBundle.node_name}.tar.gz" sb_file_path = f"{bundle_obj.bundle_path}/{bundle_obj.bundle_id}/"\ f"{TestSupportBundle.node_name}/{tar_file_name}" self.assertEqual(os.path.exists(sb_file_path), True) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsNotNone(status) self.assertIsInstance(status, str) print(status) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Success') cmd = "pcs cluster start --all" cmd_proc = SimpleProcess(cmd) _, _, rc = cmd_proc.run() self.assertEqual(rc, 0) time.sleep(5)
def test_008_wrong_comp(self): bundle_obj = SupportBundle.generate(comment=self.sb_description, components=['util;csmm']) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Error')
def test_005status(self): bundle_obj = SupportBundle.generate(comment=self.sb_description, components=['wrong']) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsNotNone(status) status = json.loads(status) self.assertEqual(status['status'], [])
def test_006status(self): # TODO - Once all components are working this test case can be removed # Getting error because of some components dont have support.yaml and # empty support.yaml bundle_obj = SupportBundle.generate(comment=self.sb_description) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Error')
def test_004status(self): bundle_obj = SupportBundle.generate(comment=self.sb_description, components=['csm']) time.sleep(5) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsNotNone(status) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Success')
def test_012_verify_SB_get_status_error_single_invalid_comp(self): """Validate SB get_status error for single invalid component.""" bundle_obj = SupportBundle.generate( comment=TestSupportBundle.sb_description, components=['util;csm']) time.sleep(15) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Error')
def test_005_verify_SB_get_status_empty_invalid_comp(self): """Validate SB get_status empty for invalid component.""" # TODO - This test can be removed once bug(EOS-24882) is fixed bundle_obj = SupportBundle.generate( comment=TestSupportBundle.sb_description, components=['wrong']) time.sleep(10) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsNotNone(status) status = json.loads(status) self.assertEqual(status['status'], [])
def test_002_verify_cortx_SB_get_status_success(self): """Validate SB get_status success.""" bundle_obj = SupportBundle.generate( comment=TestSupportBundle.sb_description, target_path=target_path, bundle_id=generate_bundle_id(), config_url=TestSupportBundle.cluster_conf_path) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsNotNone(status) self.assertIsInstance(status, str) self.assertIn("Successfully generated SB", status)
def test_003_verify_SB_get_status_success_single_comp(self): """Validate SB get_status success for single component.""" bundle_obj = SupportBundle.generate( comment=TestSupportBundle.sb_description, components=['utils']) time.sleep(15) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsNotNone(status) self.assertIsInstance(status, str) self.assertIsInstance(json.loads(status), dict) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Success')
def test_006_verify_SB_get_status_all_comp(self): """Validate SB get_status for all component.""" # TODO - Once all components are working this test case can be removed # Getting error because of some components dont have support.yaml and # empty support.yaml bundle_obj = SupportBundle.generate( comment=TestSupportBundle.sb_description) time.sleep(20) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) status = json.loads(status) if status['status']: self.assertEqual(status['status'][0]['result'], 'Error')
def get_status(args): """Get status of generated support bundle.""" bundle_id = args.bundle_id[0] if args.bundle_id else None status = SupportBundle.get_status(bundle_id=bundle_id) return status
def test_003status(self): bundle_obj = SupportBundle.generate(comment=self.sb_description, components=['csm']) status = SupportBundle.get_status(bundle_id=bundle_obj.bundle_id) self.assertIsInstance(status, str) self.assertIsInstance(json.loads(status), dict)