TestBuildAWFConfigJSON_SchemaCompliance validates that BuildAWFConfigJSON always produces JSON that conforms to the embedded AWF config schema. This test provides coverage for the validateAWFConfigJSON path, which is triggered at compile time when --validate is used (WorkflowData.ValidateAWFConfig =
(t *testing.T)
| 1068 | // (WorkflowData.ValidateAWFConfig == true). Running it unconditionally here ensures schema |
| 1069 | // compliance is verified in CI without the per-compile performance cost. |
| 1070 | func TestBuildAWFConfigJSON_SchemaCompliance(t *testing.T) { |
| 1071 | cases := []struct { |
| 1072 | name string |
| 1073 | config AWFCommandConfig |
| 1074 | }{ |
| 1075 | { |
| 1076 | name: "basic config with firewall and allowed domains", |
| 1077 | config: AWFCommandConfig{ |
| 1078 | EngineName: "copilot", |
| 1079 | AllowedDomains: "github.com,api.github.com", |
| 1080 | WorkflowData: &WorkflowData{ |
| 1081 | EngineConfig: &EngineConfig{ID: "copilot"}, |
| 1082 | NetworkPermissions: &NetworkPermissions{ |
| 1083 | Firewall: &FirewallConfig{Enabled: true}, |
| 1084 | }, |
| 1085 | }, |
| 1086 | }, |
| 1087 | }, |
| 1088 | { |
| 1089 | name: "config without network section", |
| 1090 | config: AWFCommandConfig{ |
| 1091 | EngineName: "copilot", |
| 1092 | WorkflowData: &WorkflowData{ |
| 1093 | EngineConfig: &EngineConfig{ID: "copilot"}, |
| 1094 | }, |
| 1095 | }, |
| 1096 | }, |
| 1097 | { |
| 1098 | name: "config with pinned firewall version", |
| 1099 | config: AWFCommandConfig{ |
| 1100 | EngineName: "copilot", |
| 1101 | AllowedDomains: "github.com", |
| 1102 | WorkflowData: &WorkflowData{ |
| 1103 | EngineConfig: &EngineConfig{ID: "copilot"}, |
| 1104 | NetworkPermissions: &NetworkPermissions{ |
| 1105 | Firewall: &FirewallConfig{Enabled: true, Version: "v0.24.0"}, |
| 1106 | }, |
| 1107 | }, |
| 1108 | }, |
| 1109 | }, |
| 1110 | { |
| 1111 | name: "config with model-fallback disabled", |
| 1112 | config: AWFCommandConfig{ |
| 1113 | EngineName: "copilot", |
| 1114 | AllowedDomains: "github.com", |
| 1115 | WorkflowData: func() *WorkflowData { |
| 1116 | disabled := TemplatableBool("false") |
| 1117 | return &WorkflowData{ |
| 1118 | EngineConfig: &EngineConfig{ID: "copilot"}, |
| 1119 | SandboxConfig: &SandboxConfig{ |
| 1120 | Agent: &AgentSandboxConfig{ |
| 1121 | ModelFallback: &disabled, |
| 1122 | }, |
| 1123 | }, |
| 1124 | NetworkPermissions: &NetworkPermissions{ |
| 1125 | Firewall: &FirewallConfig{Enabled: true}, |
| 1126 | }, |
| 1127 | } |
nothing calls this directly
no test coverage detected