@@ -132,42 +132,6 @@ func TestWebhook_RejectEmptyAgents(t *testing.T) {
132132 }
133133}
134134
135- func TestWebhook_RejectObjectiveTooLong (t * testing.T ) {
136- longObjective := strings .Repeat ("a" , 32769 )
137-
138- workload := & AgentWorkload {
139- Spec : AgentWorkloadSpec {
140- WorkloadType : stringPtr ("generic" ),
141- MCPServerEndpoint : stringPtr ("https://localhost:8000" ),
142- Objective : & longObjective ,
143- Agents : []string {"agent1" },
144- },
145- }
146-
147- err := workload .ValidateCreate ()
148- if err == nil {
149- t .Error ("Expected validation error for objective > 32768 characters, got nil" )
150- } else {
151- t .Logf ("Correctly rejected: %v" , err )
152- }
153- }
154-
155- func TestWebhook_AcceptsObjectiveAtLimit (t * testing.T ) {
156- objective := strings .Repeat ("a" , 32768 )
157- workload := & AgentWorkload {
158- Spec : AgentWorkloadSpec {
159- WorkloadType : stringPtr ("generic" ),
160- MCPServerEndpoint : stringPtr ("https://localhost:8000" ),
161- Objective : & objective ,
162- Agents : []string {"agent1" },
163- },
164- }
165-
166- if err := workload .ValidateCreate (); err != nil {
167- t .Fatalf ("objective at 32768-character limit was rejected: %v" , err )
168- }
169- }
170-
171135func TestWebhook_ObjectiveLimitCountsUnicodeCharacters (t * testing.T ) {
172136 objective := strings .Repeat ("é" , 32768 )
173137 workload := & AgentWorkload {
@@ -210,50 +174,6 @@ func TestWebhook_AcceptAllWorkloadTypes(t *testing.T) {
210174 t .Log ("✅ All workload types accepted" )
211175}
212176
213- func TestWebhook_DefaultAutoApproveThreshold (t * testing.T ) {
214- workload := & AgentWorkload {
215- Spec : AgentWorkloadSpec {
216- WorkloadType : stringPtr ("generic" ),
217- MCPServerEndpoint : stringPtr ("https://localhost:8000" ),
218- Objective : stringPtr ("test objective" ),
219- Agents : []string {"agent1" },
220- // No AutoApproveThreshold specified
221- },
222- }
223-
224- workload .Default ()
225-
226- if workload .Spec .AutoApproveThreshold == nil {
227- t .Error ("Expected Default() to set AutoApproveThreshold" )
228- } else if * workload .Spec .AutoApproveThreshold != "0.95" {
229- t .Errorf ("Expected default threshold 0.95, got %q" , * workload .Spec .AutoApproveThreshold )
230- } else {
231- t .Log ("✅ Default AutoApproveThreshold set correctly" )
232- }
233- }
234-
235- func TestWebhook_DefaultOPAPolicy (t * testing.T ) {
236- workload := & AgentWorkload {
237- Spec : AgentWorkloadSpec {
238- WorkloadType : stringPtr ("generic" ),
239- MCPServerEndpoint : stringPtr ("https://localhost:8000" ),
240- Objective : stringPtr ("test objective" ),
241- Agents : []string {"agent1" },
242- // No OPAPolicy specified
243- },
244- }
245-
246- workload .Default ()
247-
248- if workload .Spec .OPAPolicy == nil {
249- t .Error ("Expected Default() to set OPAPolicy" )
250- } else if * workload .Spec .OPAPolicy != "strict" {
251- t .Errorf ("Expected default policy 'strict', got %q" , * workload .Spec .OPAPolicy )
252- } else {
253- t .Log ("✅ Default OPAPolicy set correctly" )
254- }
255- }
256-
257177func TestValidateThreshold (t * testing.T ) {
258178 testCases := []struct {
259179 threshold string
0 commit comments