(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestValidateSandboxConfig(t *testing.T) { |
| 15 | tests := []struct { |
| 16 | name string |
| 17 | data *WorkflowData |
| 18 | expectError bool |
| 19 | errorMsg string |
| 20 | }{ |
| 21 | { |
| 22 | name: "nil workflow data", |
| 23 | data: nil, |
| 24 | }, |
| 25 | { |
| 26 | name: "nil sandbox config", |
| 27 | data: &WorkflowData{}, |
| 28 | }, |
| 29 | { |
| 30 | name: "valid AWF sandbox config", |
| 31 | data: &WorkflowData{ |
| 32 | SandboxConfig: &SandboxConfig{ |
| 33 | Agent: &AgentSandboxConfig{ |
| 34 | Type: SandboxTypeAWF, |
| 35 | }, |
| 36 | }, |
| 37 | Tools: map[string]any{ |
| 38 | "github": map[string]any{ |
| 39 | "mode": "remote", |
| 40 | }, |
| 41 | }, |
| 42 | }, |
| 43 | }, |
| 44 | { |
| 45 | name: "sandbox.agent false with valid justification", |
| 46 | data: &WorkflowData{ |
| 47 | Features: map[string]any{ |
| 48 | "dangerously-disable-sandbox-agent": "controlled environment with no internet access", |
| 49 | }, |
| 50 | SandboxConfig: &SandboxConfig{ |
| 51 | Agent: &AgentSandboxConfig{ |
| 52 | Disabled: true, |
| 53 | }, |
| 54 | }, |
| 55 | }, |
| 56 | }, |
| 57 | { |
| 58 | name: "sandbox.agent false without justification", |
| 59 | data: &WorkflowData{ |
| 60 | SandboxConfig: &SandboxConfig{ |
| 61 | Agent: &AgentSandboxConfig{ |
| 62 | Disabled: true, |
| 63 | }, |
| 64 | }, |
| 65 | }, |
| 66 | expectError: true, |
| 67 | errorMsg: "dangerously-disable-sandbox-agent", |
| 68 | }, |
| 69 | { |
| 70 | name: "sandbox.agent false with short justification", |
| 71 | data: &WorkflowData{ |
nothing calls this directly
no test coverage detected