MCPcopy Create free account
hub / github.com/github/gh-aw / TestValidateRuntimePackages

Function TestValidateRuntimePackages

pkg/workflow/validation_test.go:269–343  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

267}
268
269func TestValidateRuntimePackages(t *testing.T) {
270 tests := []struct {
271 name string
272 workflowData *WorkflowData
273 expectError bool
274 skipReason string
275 }{
276 {
277 name: "no runtime packages",
278 workflowData: &WorkflowData{
279 CustomSteps: "echo hello",
280 },
281 expectError: false,
282 },
283 {
284 name: "invalid mcp-scripts pip dependency name",
285 workflowData: &WorkflowData{
286 MCPScripts: &MCPScriptsConfig{
287 Tools: map[string]*MCPScriptToolConfig{
288 "fetch-url": {
289 Name: "fetch-url",
290 Description: "Fetch URL",
291 Py: "print('ok')",
292 Dependencies: []string{"re quests"},
293 },
294 },
295 },
296 },
297 expectError: true,
298 },
299 {
300 name: "floating mcp-scripts pip dependency",
301 workflowData: &WorkflowData{
302 MCPScripts: &MCPScriptsConfig{
303 Tools: map[string]*MCPScriptToolConfig{
304 "fetch-url": {
305 Name: "fetch-url",
306 Description: "Fetch URL",
307 Py: "print('ok')",
308 Dependencies: []string{"requests"},
309 },
310 },
311 },
312 },
313 expectError: true,
314 },
315 // Note: These tests would fail if npm/uv/pip are available, so we skip them
316 // The actual validation logic is tested by the extraction tests
317 }
318
319 for _, tt := range tests {
320 t.Run(tt.name, func(t *testing.T) {
321 compiler := NewCompiler()
322 err := compiler.validateRuntimePackages(tt.workflowData)
323
324 // If we expect an error and got one, or don't expect one and didn't get one, test passes
325 if tt.expectError && err == nil {
326 t.Error("expected error but got none")

Callers

nothing calls this directly

Calls 5

NewCompilerFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected