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

Function TestAwfVersionInAwInfo

pkg/workflow/aw_info_versions_test.go:162–244  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

160}
161
162func TestAwfVersionInAwInfo(t *testing.T) {
163 tests := []struct {
164 name string
165 firewallEnabled bool
166 firewallVersion string
167 agentVersion string
168 expectedAwfVersion string
169 description string
170 }{
171 {
172 name: "Firewall enabled with explicit version",
173 firewallEnabled: true,
174 firewallVersion: "v1.0.0",
175 expectedAwfVersion: "v1.0.0",
176 description: "Should use explicit firewall version",
177 },
178 {
179 name: "Firewall enabled with default version",
180 firewallEnabled: true,
181 firewallVersion: "",
182 expectedAwfVersion: string(constants.DefaultFirewallVersion),
183 description: "Should use default firewall version when not specified",
184 },
185 {
186 name: "Firewall disabled",
187 firewallEnabled: false,
188 firewallVersion: "",
189 agentVersion: "",
190 expectedAwfVersion: "",
191 description: "Should have empty awf_version when firewall is disabled",
192 },
193 {
194 name: "sandbox.agent.version overrides firewall version",
195 firewallEnabled: true,
196 firewallVersion: "",
197 agentVersion: "v0.30.1",
198 expectedAwfVersion: "v0.30.1",
199 description: "Should prefer sandbox.agent.version override",
200 },
201 }
202
203 for _, tt := range tests {
204 t.Run(tt.name, func(t *testing.T) {
205 compiler := NewCompiler(WithVersion("1.0.0"))
206 registry := GetGlobalEngineRegistry()
207 engine, err := registry.GetEngine("copilot")
208 if err != nil {
209 t.Fatalf("Failed to get copilot engine: %v", err)
210 }
211
212 workflowData := &WorkflowData{
213 Name: "Test Workflow",
214 }
215
216 if tt.firewallEnabled {
217 workflowData.NetworkPermissions = &NetworkPermissions{
218 Firewall: &FirewallConfig{
219 Enabled: true,

Callers

nothing calls this directly

Calls 8

generateCreateAwInfoMethod · 0.95
NewCompilerFunction · 0.85
WithVersionFunction · 0.85
GetGlobalEngineRegistryFunction · 0.85
GetEngineMethod · 0.80
RunMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected