Skip to content

Commit

Permalink
ducktape: Copy segment to debug if parse failed
Browse files Browse the repository at this point in the history
When parse fails in compute_storage we emit a special JSON which has the
segment path. This segment is then copied to test results for analysis.
  • Loading branch information
abhijat committed Aug 23, 2024
1 parent 89b53b8 commit f9e7ab1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/rptest/services/redpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4396,7 +4396,18 @@ def node_storage(self,
output = node.account.ssh_output(shlex.join(cmd),
combine_stderr=False,
timeout_sec=10)
namespaces = json.loads(output)
json_output = json.loads(output)
if "parse_failed" in json_output:
self.logger.error(f"segment parsing failed: {json_output}")
segment_src = json_output["segment"]
segment_destination = os.path.join(
TestContext.results_dir(self._context,
self._context.test_index), segment_src)
self.logger.info(
f"copying segment from {segment_src} to {segment_destination}")
node.account.copy_from(segment_src, segment_destination)
raise AssertionError
namespaces = json_output
for ns, topics in namespaces.items():
ns_path = os.path.join(store.data_dir, ns)
ns = store.add_namespace(ns, ns_path)
Expand Down

0 comments on commit f9e7ab1

Please sign in to comment.