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

Function TestApplySandboxDefaults

pkg/workflow/sandbox_test.go:116–246  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestApplySandboxDefaults(t *testing.T) {
117 tests := []struct {
118 name string
119 config *SandboxConfig
120 engine *EngineConfig
121 expected *SandboxConfig
122 expectDefaultWritePath bool
123 expectedAllowWrite []string
124 }{
125 {
126 name: "nil config creates default with AWF",
127 config: nil,
128 engine: &EngineConfig{ID: "copilot"},
129 expectDefaultWritePath: true,
130 expected: &SandboxConfig{
131 Agent: &AgentSandboxConfig{
132 Type: SandboxTypeAWF,
133 },
134 },
135 },
136 {
137 name: "explicit AWF config preserved",
138 config: &SandboxConfig{
139 Agent: &AgentSandboxConfig{
140 Type: SandboxTypeAWF,
141 },
142 },
143 engine: &EngineConfig{ID: "copilot"},
144 expectDefaultWritePath: true,
145 expected: &SandboxConfig{
146 Agent: &AgentSandboxConfig{
147 Type: SandboxTypeAWF,
148 },
149 },
150 },
151 {
152 // version-only object (no id/type) must default to AWF so the sandbox is
153 // always enabled, matching the previous analysis of the smoke-gemini bug.
154 name: "version-only agent defaults to AWF",
155 config: &SandboxConfig{
156 Agent: &AgentSandboxConfig{
157 Version: "v0.25.29",
158 },
159 },
160 engine: &EngineConfig{ID: "gemini"},
161 expectDefaultWritePath: true,
162 expected: &SandboxConfig{
163 Agent: &AgentSandboxConfig{
164 Type: SandboxTypeAWF,
165 Version: "v0.25.29",
166 },
167 },
168 },
169 {
170 // An agent object with only an empty string ID must also default to AWF.
171 name: "empty ID agent defaults to AWF",
172 config: &SandboxConfig{
173 Agent: &AgentSandboxConfig{},

Callers

nothing calls this directly

Calls 2

applySandboxDefaultsFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected