Skip to content

Commit 234fc03

Browse files
Dumbrisclaude
andcommitted
test: update upstream_cmd tests for unified health status format
The table output format was changed to use unified health status instead of separate ENABLED/CONNECTED columns. Updated tests to: - Check for new headers: NAME, PROTOCOL, TOOLS, STATUS, ACTION - Verify health status emojis (✅, ⏸️, 🔒, ❌) based on health level and admin state instead of yes/no boolean values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 598cb5f commit 234fc03

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

cmd/mcpproxy/upstream_cmd_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,22 @@ func TestOutputServers_TableFormat(t *testing.T) {
4949
t.Errorf("outputServers() returned error: %v", err)
5050
}
5151

52-
// Verify table headers
52+
// Verify table headers (new unified health status format)
5353
if !strings.Contains(output, "NAME") {
5454
t.Error("Table output missing NAME header")
5555
}
56-
if !strings.Contains(output, "ENABLED") {
57-
t.Error("Table output missing ENABLED header")
58-
}
5956
if !strings.Contains(output, "PROTOCOL") {
6057
t.Error("Table output missing PROTOCOL header")
6158
}
62-
if !strings.Contains(output, "CONNECTED") {
63-
t.Error("Table output missing CONNECTED header")
64-
}
6559
if !strings.Contains(output, "TOOLS") {
6660
t.Error("Table output missing TOOLS header")
6761
}
6862
if !strings.Contains(output, "STATUS") {
6963
t.Error("Table output missing STATUS header")
7064
}
65+
if !strings.Contains(output, "ACTION") {
66+
t.Error("Table output missing ACTION header")
67+
}
7168

7269
// Verify server data
7370
if !strings.Contains(output, "github-server") {
@@ -360,27 +357,32 @@ func TestCreateUpstreamLogger(t *testing.T) {
360357
}
361358

362359
func TestOutputServers_BooleanFields(t *testing.T) {
360+
// Test that unified health status is displayed correctly based on server state
363361
tests := []struct {
364-
name string
365-
enabled bool
366-
connected bool
362+
name string
363+
healthLevel string
364+
adminState string
365+
expectedEmoji string
367366
}{
368-
{"both true", true, true},
369-
{"both false", false, false},
370-
{"enabled only", true, false},
371-
{"connected only", false, true},
367+
{"healthy enabled", "healthy", "enabled", "✅"},
368+
{"disabled", "healthy", "disabled", "⏸️"},
369+
{"quarantined", "healthy", "quarantined", "🔒"},
370+
{"unhealthy", "unhealthy", "enabled", "❌"},
372371
}
373372

374373
for _, tt := range tests {
375374
t.Run(tt.name, func(t *testing.T) {
376375
servers := []map[string]interface{}{
377376
{
378377
"name": "test-server",
379-
"enabled": tt.enabled,
380378
"protocol": "stdio",
381-
"connected": tt.connected,
382379
"tool_count": 0,
383-
"status": "test",
380+
"health": map[string]interface{}{
381+
"level": tt.healthLevel,
382+
"admin_state": tt.adminState,
383+
"summary": "Test status",
384+
"action": "",
385+
},
384386
},
385387
}
386388

@@ -402,11 +404,9 @@ func TestOutputServers_BooleanFields(t *testing.T) {
402404
t.Errorf("outputServers() returned error: %v", err)
403405
}
404406

405-
// Verify boolean conversion
406-
if tt.enabled {
407-
if !strings.Contains(output, "yes") {
408-
t.Error("Expected 'yes' for enabled=true")
409-
}
407+
// Verify health status emoji is displayed
408+
if !strings.Contains(output, tt.expectedEmoji) {
409+
t.Errorf("Expected emoji '%s' for %s, output: %s", tt.expectedEmoji, tt.name, output)
410410
}
411411
})
412412
}

0 commit comments

Comments
 (0)