(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestValidateContainerImages(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | workflowData *WorkflowData |
| 15 | expectError bool |
| 16 | skipIfNoDocker bool |
| 17 | }{ |
| 18 | { |
| 19 | name: "no tools", |
| 20 | workflowData: &WorkflowData{ |
| 21 | Tools: nil, |
| 22 | }, |
| 23 | expectError: false, |
| 24 | }, |
| 25 | { |
| 26 | name: "tools without container", |
| 27 | workflowData: &WorkflowData{ |
| 28 | Tools: map[string]any{ |
| 29 | "github": map[string]any{ |
| 30 | "command": "npx", |
| 31 | "args": []any{"@github/github-mcp-server"}, |
| 32 | }, |
| 33 | }, |
| 34 | }, |
| 35 | expectError: false, |
| 36 | }, |
| 37 | { |
| 38 | name: "valid container image", |
| 39 | workflowData: &WorkflowData{ |
| 40 | Tools: map[string]any{ |
| 41 | "test-tool": map[string]any{ |
| 42 | "container": "alpine", |
| 43 | "version": "latest", |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | expectError: false, |
| 48 | skipIfNoDocker: true, |
| 49 | }, |
| 50 | { |
| 51 | name: "invalid container image", |
| 52 | workflowData: &WorkflowData{ |
| 53 | Tools: map[string]any{ |
| 54 | "test-tool": map[string]any{ |
| 55 | "container": "nonexistent-image-that-should-not-exist-12345", |
| 56 | "version": "nonexistent", |
| 57 | }, |
| 58 | }, |
| 59 | }, |
| 60 | expectError: true, |
| 61 | skipIfNoDocker: true, |
| 62 | }, |
| 63 | } |
| 64 | |
| 65 | for _, tt := range tests { |
| 66 | t.Run(tt.name, func(t *testing.T) { |
| 67 | // Skip test if docker daemon is not running |
| 68 | if tt.skipIfNoDocker { |
nothing calls this directly
no test coverage detected