CAMEL-23921: Replace Thread.sleep with Awaitility in SFTP tests#24603
Conversation
- MinaSftpAdvancedFileOperationsIT: replace 3x Thread.sleep(500) after mock assertions with Awaitility to wait for filesystem move operations - MinaSftpProtocolIT: replace 2x Thread.sleep(1000) after mock assertions with Awaitility for file delete/move; replace Thread.sleep(2000) timestamp gap with explicit setLastModified() - MinaSftpConcurrencyIT: remove 2x unnecessary pacing delays (Thread.sleep(50/100)) in concurrent read/write test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 9 all testedMaveniverse Scalpel detected 1 affected modules (current approach: 9). Modules only in current approach (8)
Skip-tests mode would test 1 modules (1 direct + 0 downstream), skip tests for 0 (generated code, meta-modules) Modules Scalpel would test (1)
All tested modules (9 modules)
|
gnodet
left a comment
There was a problem hiding this comment.
Claude Code self-review on behalf of @gnodet
LGTM — clean Thread.sleep→Awaitility migration, follows project guidelines exactly.
Review
All three changes are correct:
-
MinaSftpAdvancedFileOperationsIT— 3xThread.sleep(500)→Awaitility.await().atMost(10, SECONDS).untilAsserted(...)for post-move filesystem checks. Correct — these wrap filesystem state assertions, notMockEndpoint. -
MinaSftpProtocolIT— 2xThread.sleep(1000)→ Awaitility for file delete/move; 1xThread.sleep(2000)→setLastModified()to create a past timestamp instead of sleeping for clock drift. ThesetLastModifiedapproach is elegant — eliminates the delay entirely. -
MinaSftpConcurrencyIT— 2x pacing sleeps (50ms/100ms) removed from concurrent read/write threads. These were unnecessary for correctness.
Checklist
- ✅ Awaitility wraps only filesystem assertions —
MockEndpoint.assertIsSatisfied()calls remain unwrapped (they already wait viaCountDownLatch) - ✅ All
atMosttimeouts are explicit (10 seconds) - ✅
untilAssertedused with clear predicates - ✅ No new
Thread.sleepintroduced - ✅ Imports clean —
static importforAwaitility.await()
No concerns. Ready for merge (pending human approval).
Claude Code on behalf of @gnodet
Summary
Replaces all
Thread.sleep()calls in threecamel-mina-sftpintegration test classes with proper condition-based waiting, per project guidelines.MinaSftpAdvancedFileOperationsIT: 3xThread.sleep(500)→Awaitility.await().untilAsserted(...)for filesystem move verification aftermock.assertIsSatisfied()MinaSftpProtocolIT: 2xThread.sleep(1000)→Awaitility.await().untilAsserted(...)for filesystem delete/move; 1xThread.sleep(2000)→ explicitfile.setLastModified()(no delay needed)MinaSftpConcurrencyIT: 2xThread.sleep(50/100)removed — these were unnecessary pacing delays in concurrent threads that don't affect correctnessImportant: The Awaitility calls wrap only the filesystem assertions (file exists, file deleted, file moved) — they do NOT wrap
MockEndpoint.assertIsSatisfied(), which already waits internally viaCountDownLatch.Changed files
MinaSftpAdvancedFileOperationsIT.javaMinaSftpProtocolIT.javasetLastModified()MinaSftpConcurrencyIT.javaTest plan
formatter:validate,impsort:check)🤖 Generated with Claude Code