Commit 44146b4
Improve integration test performance with conservative optimizations (#2962)
* Optimize integration test execution time (conservative approach)
This commit implements targeted optimizations to reduce integration test
execution time by 40-50% (from ~247s to ~120-140s) while maintaining full
test coverage and test behavior consistency.
Key improvements:
1. Optimized crawler configurations
- Reduced max_access_count: 100 → 20 (SearchApiTests)
- Changed external URLs to localhost to avoid network latency
(https://www.codelibs.org/ → http://localhost:8080/)
- Set interval_time to 0 (no delay between requests)
2. Enhanced waitJob() with exponential backoff
- Initial sleep: 50ms, gradually increasing to 300ms for startup
- Termination wait: 100ms, gradually increasing to 500ms
- Reduces unnecessary polling while maintaining responsiveness
- More efficient resource usage during crawler execution
3. Reduced test data volume
- CrudTestBase NUM: 20 → 10 (still sufficient for CRUD validation)
Intentionally NOT optimized:
- OpenSearch refresh() calls remain unchanged
- Required for eventual consistency guarantees
- Removing refresh() risks test flakiness and false positives
- Critical for maintaining predictable test behavior
Test coverage maintained:
- All API endpoints (GET, POST, PUT, DELETE) still tested
- All search query variations preserved
- Pagination and filtering tests remain comprehensive
- Error cases still validated
Expected improvement: 40-50% reduction in test execution time
- FailureUrlTests: 42.74s → ~25-30s
- JobLogTests: 46.78s → ~25-30s
- CrawlerLogTests: 57.09s → ~30-35s
- SearchApiTests: 84.90s → ~40-50s
- BadWordTests: 15.46s → ~8-10s
* Revert localhost URL change to fix CI failures
The previous optimization changed external URLs to localhost:8080 to avoid
network latency. However, this caused issues in CI environment:
- Crawling the Fess server itself creates unpredictable test behavior
- May cause circular dependencies or performance issues
- Generates excessive error logs that affect Maven exit code
This commit reverts the URL changes while keeping other optimizations:
- max_access_count reductions (still effective)
- interval_time = 0 (no delay between requests)
- Exponential backoff in waitJob()
- Reduced test data volume (NUM = 10)
The external URL (https://www.codelibs.org/) provides stable, predictable
content for testing, ensuring consistent test results.
Expected improvement: 25-35% reduction in test execution time
(primarily from max_access_count and interval_time optimizations)
* Revert SearchApiTests max_access_count to fix test failures
The previous optimization reduced max_access_count from 100 to 20 in
SearchApiTests, which caused 6 test failures:
- searchTestWithMultipleWord
- searchTestWithAndOperation
- searchTestWithFuzzy
- searchTestWithInUrl
- searchTestWithLabel
- searchTestWithRange
Root cause:
SearchApiTests requires diverse documents to test various search scenarios
(labels, URL patterns, ranges, fuzzy matching, etc.). With only 20 files
indexed, many search queries returned no results.
Solution:
Revert max_access_count to 100 for SearchApiTests while keeping other
optimizations:
- interval_time = 0 (no delay between file accesses)
- Exponential backoff in waitJob()
- Reduced test data volume (NUM = 10)
- Web crawl tests still optimized (max_access_count 1-2)
Updated expectations:
- Previous target: 40-50% reduction (was too aggressive)
- Revised target: 20-30% reduction (more realistic)
- Expected time: 165-195 seconds (from 247 seconds)
The primary time savings now come from:
1. interval_time reduction (10-20% improvement)
2. Exponential backoff in polling (5-10% improvement)
3. Reduced CRUD test data (5-10% improvement)
* Delete TEST_OPTIMIZATION_PROPOSAL.md
---------
Co-authored-by: Claude <[email protected]>1 parent 2dc5ace commit 44146b4
File tree
6 files changed
+29
-13
lines changed- src/test/java/org/codelibs/fess/it
- admin
- search
6 files changed
+29
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | | - | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| |||
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
82 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
88 | 102 | | |
89 | 103 | | |
90 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
173 | | - | |
| 174 | + | |
174 | 175 | | |
175 | | - | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
257 | 258 | | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
264 | | - | |
| 265 | + | |
265 | 266 | | |
266 | | - | |
| 267 | + | |
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
| 402 | + | |
403 | 403 | | |
404 | | - | |
| 404 | + | |
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| |||
0 commit comments