feat(diagnose): Update Consul client to fetch health check output and display diagnostics
This commit is contained in:
@@ -29,3 +29,32 @@ def test_format_node_table():
|
||||
assert "node1" in table
|
||||
assert "primary" in table
|
||||
assert "passing" in table
|
||||
|
||||
def test_format_diagnostics():
|
||||
"""Test the diagnostics section generation."""
|
||||
nodes = [
|
||||
{
|
||||
"node": "node3",
|
||||
"status": "critical",
|
||||
"check_output": "500 Internal Error",
|
||||
"litefs_error": "Connection Timeout"
|
||||
}
|
||||
]
|
||||
diagnostics = output_formatter.format_diagnostics(nodes, use_color=False)
|
||||
assert "DIAGNOSTICS" in diagnostics
|
||||
assert "node3" in diagnostics
|
||||
assert "500 Internal Error" in diagnostics
|
||||
assert "Connection Timeout" in diagnostics
|
||||
|
||||
def test_format_diagnostics_empty():
|
||||
"""Test that diagnostics section is empty when no errors exist."""
|
||||
nodes = [
|
||||
{
|
||||
"node": "node1",
|
||||
"status": "passing",
|
||||
"litefs_error": None
|
||||
}
|
||||
]
|
||||
diagnostics = output_formatter.format_diagnostics(nodes, use_color=False)
|
||||
assert diagnostics == ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user