Skip to content

Commit 2d687a1

Browse files
Copilotpelikhan
andcommitted
Update tests for CLI argument-based MCP configuration
- Update TestCodexMCPConfigGeneration to expect no mcp-servers.json file for Claude - Update TestGitHubRemoteModeConfiguration to check for JSON in CLI argument for Claude - Update local mode tests to check for Docker command in JSON config - Update Claude engine tests to verify new CLI argument approach Most tests now passing with only 5 remaining failures to fix. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 64e0bf5 commit 2d687a1

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

pkg/workflow/codex_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ tools:
280280
---`,
281281
expectedAI: "claude",
282282
expectConfigToml: false,
283-
expectMcpServersJson: true,
283+
expectMcpServersJson: false, // Changed: Claude now passes config via CLI argument, not file
284284
expectCodexHome: false,
285285
},
286286
{
@@ -306,7 +306,7 @@ tools:
306306
---`,
307307
expectedAI: "claude",
308308
expectConfigToml: false,
309-
expectMcpServersJson: true,
309+
expectMcpServersJson: false, // Changed: Claude now passes config via CLI argument, not file
310310
expectCodexHome: false,
311311
},
312312
{
@@ -332,7 +332,7 @@ tools:
332332
---`,
333333
expectedAI: "claude",
334334
expectConfigToml: false,
335-
expectMcpServersJson: true,
335+
expectMcpServersJson: false, // Changed: Claude now passes config via CLI argument, not file
336336
expectCodexHome: false,
337337
},
338338
{

pkg/workflow/github_remote_mode_test.go

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,44 @@ This is a test workflow for GitHub remote mode configuration.
210210
if strings.Contains(lockContent, `command = "docker"`) {
211211
t.Errorf("Expected no Docker command but found it in:\n%s", lockContent)
212212
}
213+
} else if tt.engineType == "claude" {
214+
// Claude passes MCP config as CLI argument, not in a setup step
215+
// Check for --mcp-config flag with JSON string
216+
if !strings.Contains(lockContent, `--mcp-config`) {
217+
t.Errorf("Expected --mcp-config CLI flag but didn't find it in:\n%s", lockContent)
218+
}
219+
// Check for mcpServers in the JSON config string
220+
if !strings.Contains(lockContent, `mcpServers`) {
221+
t.Errorf("Expected mcpServers in JSON config but didn't find it in:\n%s", lockContent)
222+
}
223+
// Check for the expected URL in the JSON
224+
if tt.expectedURL != "" && !strings.Contains(lockContent, strings.ReplaceAll(tt.expectedURL, "/", "\\/")) {
225+
// Also try without escaped slashes (depends on JSON generation)
226+
if !strings.Contains(lockContent, tt.expectedURL) {
227+
t.Errorf("Expected URL %s in JSON config but didn't find it in:\n%s", tt.expectedURL, lockContent)
228+
}
229+
}
230+
// Check for Authorization header with token in the JSON
231+
if tt.expectedToken != "" {
232+
expectedAuthHeader := `"Authorization":"Bearer ` + tt.expectedToken + `"`
233+
// Also check without spaces (minified JSON)
234+
expectedAuthHeaderMinified := strings.ReplaceAll(expectedAuthHeader, " ", "")
235+
if !strings.Contains(lockContent, expectedAuthHeader) && !strings.Contains(lockContent, expectedAuthHeaderMinified) {
236+
t.Errorf("Expected Authorization header with token %s in JSON config but didn't find it in:\n%s", tt.expectedToken, lockContent)
237+
}
238+
}
239+
// Check for X-MCP-Readonly header if this is a read-only test
240+
if strings.Contains(tt.name, "read-only") {
241+
if !strings.Contains(lockContent, `X-MCP-Readonly`) {
242+
t.Errorf("Expected X-MCP-Readonly header in JSON config but didn't find it in:\n%s", lockContent)
243+
}
244+
}
245+
// Should NOT contain Docker configuration
246+
if strings.Contains(lockContent, `"command":"docker"`) && strings.Contains(lockContent, `"command": "docker"`) {
247+
t.Errorf("Expected no Docker command but found it in:\n%s", lockContent)
248+
}
213249
} else {
214-
// Check for JSON format
250+
// Check for JSON format (Copilot and other engines)
215251
if !strings.Contains(lockContent, `"type": "http"`) {
216252
t.Errorf("Expected HTTP configuration but didn't find 'type: http' in:\n%s", lockContent)
217253
}
@@ -257,8 +293,13 @@ This is a test workflow for GitHub remote mode configuration.
257293
if !strings.Contains(lockContent, `command = "docker"`) {
258294
t.Errorf("Expected Docker command but didn't find it in:\n%s", lockContent)
259295
}
296+
case "claude":
297+
// Claude passes MCP config as CLI argument, check for Docker in JSON
298+
if !strings.Contains(lockContent, `"command":"docker"`) && !strings.Contains(lockContent, `"command": "docker"`) {
299+
t.Errorf("Expected Docker command in JSON config but didn't find it in:\n%s", lockContent)
300+
}
260301
default:
261-
// For Claude, check for Docker command
302+
// For other engines, check for Docker command in JSON
262303
if !strings.Contains(lockContent, `"command": "docker"`) {
263304
t.Errorf("Expected Docker command but didn't find it in:\n%s", lockContent)
264305
}

0 commit comments

Comments
 (0)