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

Function TestValidateContainerImages

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

Source from the content-addressed store, hash-verified

9)
10
11func 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 {

Callers

nothing calls this directly

Calls 6

NewCompilerFunction · 0.85
isDockerDaemonRunningFunction · 0.70
RunMethod · 0.45
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected