Skip to content

Commit

Permalink
ducktape: Capture parse failures explicitly
Browse files Browse the repository at this point in the history
Since the compute storage script runs over ssh and the output is
expected to be JSON, the errors need to be presented as a special JSON
structure.
  • Loading branch information
abhijat committed Aug 23, 2024
1 parent 9d9a148 commit 89b53b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/rptest/remote_scripts/compute_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def compute_size_for_file(file: Path, calc_md5: bool):
def compute_size(data_dir: Path, sizes: bool, calculate_md5: bool,
print_flat: bool):
output = {}
segment_parse_error = {}
for ns in safe_listdir(data_dir):
if not safe_isdir(ns):
continue
Expand All @@ -144,6 +145,14 @@ def compute_size(data_dir: Path, sizes: bool, calculate_md5: bool,
# It's valid to have a segment deleted
# at anytime
continue
except AssertionError as e:
if print_flat:
raise e
return {
"parse_failed": True,
"segment": segment,
"error": str(e)
}
part_output[segment.name] = seg_output
topic_output[partition.name] = part_output
ns_output[topic.name] = topic_output
Expand Down

0 comments on commit 89b53b8

Please sign in to comment.