def get_results(self): ret = [] results = [] LOGGER.debug('Wait for %s stress threads results', self.max_workers) for future in concurrent.futures.as_completed(self.results_futures, timeout=self.timeout): results.append(future.result()) for _, result in results: if not result: # Silently skip if stress command threw error, since it was already reported in _run_stress continue output = result.stdout + result.stderr try: lines = output.splitlines() node_cs_res = BaseLoaderSet._parse_cs_summary(lines) # pylint: disable=protected-access if node_cs_res: ret.append(node_cs_res) except Exception as exc: # pylint: disable=broad-except CassandraStressEvent.failure( node="", errors=[ f"Failed to process stress summary due to {exc}", ]) return ret
def test_with_errors(self): event = CassandraStressEvent.failure(node="node1", errors=["e1", "e2"]) self.assertEqual(event.severity, Severity.CRITICAL) self.assertEqual(event.node, "node1") self.assertIsNone(event.stress_cmd) self.assertIsNone(event.log_file_name) self.assertEqual(event.errors, ["e1", "e2"]) self.assertEqual( str(event), "(CassandraStressEvent Severity.CRITICAL): type=failure node=node1\ne1\ne2" ) self.assertEqual(event, pickle.loads(pickle.dumps(event)))