nzw921rx opened a new pull request, #10972:
URL: https://github.com/apache/seatunnel/pull/10972

   ### Purpose of this pull request
   
   Fix SFTP E2E flaky test (`SftpFileIT.java`) — multiple issues across 
resource management, assertions, and timing causing intermittent CI failures.
   
   **Resource issues:**
   - Pin SFTP Docker image to `atmoz/sftp:alpine-3.7` (was `:latest`) to 
prevent cross-run version drift
   - Add `Wait.forListeningPort()` WaitStrategy to ensure SSHD is ready before 
file operations; remove redundant double-start (`sftpContainer.start()` + 
`Startables.deepStart()`)
   - Remove hardcoded host port binding `2222:22` to avoid port conflicts in 
parallel CI; rely on Testcontainers random port + Docker network alias `sftp:22`
   - Replace low-level `dockerClient.execCreateCmd` with 
`sftpContainer.execInContainer()` in `getFileListFromContainer` and 
`deleteFileFromContainer`
   
   **Assertion issues:**
   - Fix `getFileListFromContainer` returning `ls` stderr as filenames when 
directory doesn't exist; now checks exit code and returns empty list on failure
   - Replace immediate `assertEquals(size, N)` file-count assertions with 
`Awaitility.await()` polling (30s timeout) to handle file commit delay (rename 
from tmp)
   - Add `awaitFileCount()` helper used in `testMultipleTableAndSaveMode` and 
`testSftpFileReadAndWrite`
   
   **Timing issues:**
   - Increase `Awaitility.atMost` from 60s to 120s in 
`testSftpBinaryUpdateModeContinuousDiscoveryDistcp` for both file-appearance 
checks
   - Replace `Thread.sleep(2500)` mtime-stability check with 
`Awaitility.during(6s)` — verifies mtime stays unchanged for 6 consecutive 
seconds (covering 6+ scan intervals), instead of a single point-in-time check 
that could pass immediately
   - Replace `Thread.sleep(1100)` mtime-gap guarantee with 
`waitUntilContainerTimeAfter()` — polls container clock until epoch second is 
strictly after src mtime, then writes dst file, ensuring deterministic mtime 
ordering for distcp `len_mtime` comparison
   - Verify `chown -R` exit code after file copy to catch permission failures 
early
   - Wrap `testFtpToAssertJsonFilter`, `testSftpBinaryUpdateModeDistcp`, and 
`testSftpBinaryUpdateModeContinuousDiscoveryDistcp` with `try-finally` for 
guaranteed cleanup
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only changes.
   
   ### How was this patch tested?
   
   ```bash
   ./mvnw -pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-file-sftp-e2e 
-DskipUT -DskipIT=false verify
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to