(t *testing.T)
| 481 | } |
| 482 | |
| 483 | func TestLocalSandbox_CommandStats(t *testing.T) { |
| 484 | tmpDir, err := os.MkdirTemp("", "sandbox-test-*") |
| 485 | if err != nil { |
| 486 | t.Fatalf("failed to create temp dir: %v", err) |
| 487 | } |
| 488 | defer func() { _ = os.RemoveAll(tmpDir) }() |
| 489 | |
| 490 | sb, err := NewLocalSandbox(&LocalSandboxConfig{ |
| 491 | WorkDir: tmpDir, |
| 492 | }) |
| 493 | if err != nil { |
| 494 | t.Fatalf("failed to create sandbox: %v", err) |
| 495 | } |
| 496 | |
| 497 | // Execute echo multiple times |
| 498 | for range 5 { |
| 499 | _, _ = sb.Exec(context.Background(), "echo test", nil) |
| 500 | } |
| 501 | |
| 502 | stats := sb.GetCommandStats() |
| 503 | echoStats, ok := stats["echo"] |
| 504 | if !ok { |
| 505 | t.Fatal("expected stats for echo command") |
| 506 | } |
| 507 | if echoStats.TotalCalls != 5 { |
| 508 | t.Errorf("expected 5 calls, got %d", echoStats.TotalCalls) |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | func TestLocalSandbox_BlockedCommands(t *testing.T) { |
| 513 | tmpDir, err := os.MkdirTemp("", "sandbox-test-*") |
nothing calls this directly
no test coverage detected