Skip to content

Commit f4f7c6c

Browse files
committed
Add test for error path in BuildFromProtocolSchemeWithName
1 parent 4f8181b commit f4f7c6c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/runner/protocol_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ func TestBuildFromProtocolSchemeWithNameDryRun(t *testing.T) {
241241
tests := []struct {
242242
name string
243243
serverOrImage string
244+
caCertPath string
244245
buildArgs []string
245246
wantContains []string
246247
wantErr bool
@@ -276,6 +277,13 @@ func TestBuildFromProtocolSchemeWithNameDryRun(t *testing.T) {
276277
},
277278
wantErr: false,
278279
},
280+
{
281+
name: "NPX with buildArgs and invalid CA cert path",
282+
serverOrImage: "npx://@launchdarkly/mcp-server",
283+
caCertPath: "/nonexistent/ca-cert.crt",
284+
buildArgs: []string{"start"},
285+
wantErr: true,
286+
},
279287
}
280288

281289
for _, tt := range tests {
@@ -285,7 +293,7 @@ func TestBuildFromProtocolSchemeWithNameDryRun(t *testing.T) {
285293

286294
// Call BuildFromProtocolSchemeWithName with dry-run=true
287295
dockerfileContent, err := BuildFromProtocolSchemeWithName(
288-
ctx, nil, tt.serverOrImage, "", "", tt.buildArgs, true)
296+
ctx, nil, tt.serverOrImage, tt.caCertPath, "", tt.buildArgs, true)
289297

290298
if (err != nil) != tt.wantErr {
291299
t.Errorf("BuildFromProtocolSchemeWithName() error = %v, wantErr %v", err, tt.wantErr)

0 commit comments

Comments
 (0)