(t *testing.T)
| 262 | } |
| 263 | |
| 264 | func TestReadTool_ConcurrentReads(t *testing.T) { |
| 265 | tool, err := NewReadTool(nil) |
| 266 | if err != nil { |
| 267 | t.Fatalf("Failed to create Read tool: %v", err) |
| 268 | } |
| 269 | |
| 270 | helper := NewTestHelper(t) |
| 271 | defer helper.CleanupAll() |
| 272 | |
| 273 | // 创建测试文件 |
| 274 | testContent := "Concurrent test content" |
| 275 | filePath := helper.CreateTempFile("concurrent.txt", testContent) |
| 276 | |
| 277 | concurrency := 10 |
| 278 | result := RunConcurrentTest(concurrency, func() error { |
| 279 | input := map[string]any{ |
| 280 | "file_path": filePath, |
| 281 | } |
| 282 | result := ExecuteToolWithRealFS(t, tool, input) |
| 283 | if !result["ok"].(bool) { |
| 284 | return errors.New("Tool execution failed") |
| 285 | } |
| 286 | return nil |
| 287 | }) |
| 288 | |
| 289 | if result.ErrorCount > 0 { |
| 290 | t.Errorf("Concurrent reads failed: %d errors out of %d attempts", |
| 291 | result.ErrorCount, concurrency) |
| 292 | for _, err := range result.Errors { |
| 293 | t.Logf("Error: %v", err) |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | t.Logf("Concurrent reads completed: %d success, %d errors in %v", |
| 298 | result.SuccessCount, result.ErrorCount, result.Duration) |
| 299 | } |
| 300 | |
| 301 | func TestReadTool_DirectoryTraversal(t *testing.T) { |
| 302 | t.Skip("Skipping: directory traversal protection not fully implemented") |
nothing calls this directly
no test coverage detected