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

Function TestRepoMemoryMaxFileSizeValidation

pkg/workflow/repo_memory_test.go:355–441  ·  view source on GitHub ↗

TestRepoMemoryMaxFileSizeValidation tests max-file-size boundary validation

(t *testing.T)

Source from the content-addressed store, hash-verified

353
354// TestRepoMemoryMaxFileSizeValidation tests max-file-size boundary validation
355func TestRepoMemoryMaxFileSizeValidation(t *testing.T) {
356 tests := []struct {
357 name string
358 maxFileSize int
359 wantError bool
360 errorText string
361 }{
362 {
363 name: "valid minimum size (1 byte)",
364 maxFileSize: 1,
365 wantError: false,
366 },
367 {
368 name: "valid maximum size (104857600 bytes)",
369 maxFileSize: 104857600,
370 wantError: false,
371 },
372 {
373 name: "valid mid-range size (10240 bytes)",
374 maxFileSize: 10240,
375 wantError: false,
376 },
377 {
378 name: "invalid zero size",
379 maxFileSize: 0,
380 wantError: true,
381 errorText: "max-file-size must be between 1 and 104857600, got 0",
382 },
383 {
384 name: "invalid negative size",
385 maxFileSize: -1,
386 wantError: true,
387 errorText: "max-file-size must be between 1 and 104857600, got -1",
388 },
389 {
390 name: "invalid size exceeds maximum",
391 maxFileSize: 104857601,
392 wantError: true,
393 errorText: "max-file-size must be between 1 and 104857600, got 104857601",
394 },
395 {
396 name: "invalid large size",
397 maxFileSize: 200000000,
398 wantError: true,
399 errorText: "max-file-size must be between 1 and 104857600, got 200000000",
400 },
401 }
402
403 for _, tt := range tests {
404 t.Run(tt.name, func(t *testing.T) {
405 toolsMap := map[string]any{
406 "repo-memory": map[string]any{
407 "max-file-size": tt.maxFileSize,
408 },
409 }
410
411 toolsConfig, err := ParseToolsConfig(toolsMap)
412 if err != nil {

Callers

nothing calls this directly

Calls 6

ParseToolsConfigFunction · 0.85
NewCompilerFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected