Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/ccmcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def parse_cluster_status(self, stdout):
"""
nodes_status = []
for line in stdout.split("\n")[2:]:
node, status = line.split(":")
chunks = line.split(":")
if len(chunks) != 2:
Copy link
Contributor

@tchaikov tchaikov Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

presumably it was an empty line which broke the test. an alternative is:

if not line:
    # ignore empty lines
    continue
node, status = line.split(":", 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

presumably it was an empty line which broke the test. an alternative is:

tbh, I have no idea which line broke it, but it is better to make it as resiliant as possible.

if not line:
    # ignore empty lines
    continue
node, status = line.split(":", 1)

This code will still fail if line does not contain ':'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, by looking at the error message, i think the offending line was empty.

as resiliant as possible.

i disagree. we program with a contract. "as resilient as possible" without a contract is error-prune, because we don't have a standard or contract for "as resilient as possible".

anyway, this is not that important in this context.

continue
node, status = chunks
nodes_status.append((node.strip(), status.strip()))

return nodes_status
Expand Down
Loading