fix(reporter): time out a PasteBin upload instead of hanging forever - #64
fix(reporter): time out a PasteBin upload instead of hanging forever#64soloturn wants to merge 1 commit into
Conversation
Found while manually testing the reporter dialog: clicking "PasteBin" disabled the button, showed "please wait", and never resolved either way. PastebinUploadRunnable.call() makes a real HTTP POST via jpastebin with no timeout of its own, and UploadPanel.upload() just ran it on a bare thread and waited unboundedly for callable.call() to return - a slow or unreachable server left no way to tell "still working" from "will never finish". upload() now submits to an ExecutorService and waits at most 30s (configurable via a package-private constructor for tests) via future.get(timeout, SECONDS), cancelling the future and reporting a clear "Upload timed out after 30s" failure if it's not done by then. The wait-and-dispatch logic is split into a small static method, awaitUpload(), that's plain Future/Consumer plumbing with no Swing dependency - lets UploadPanelTest exercise the timeout, success, and underlying-failure-unwrapped-from-ExecutionException paths directly against real Futures, without a button-click harness. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I have some concerns here about unit tests reaching out to external URLs, especially for potentially modifying operations, such as POST. The unit tests should be capable of running completely offline. |
Addresses @BenjaminAmos's review concern on #64 (now folded into this PR): these tests are already fully offline - PastebinUploadRunnable is never instantiated, and new URL(...) only parses a string, it never opens a connection. Making that explicit in the class javadoc so it isn't mistaken for a real network-touching test again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Re: @BenjaminAmos's comment on #64 (now here) about tests reaching out to external URLs - clarifying, since that PR's gone: neither
So these are already fully offline and deterministic; nothing to change on that front. Happy to add an explicit comment in the test file noting this if it'd help future reviewers. |
Summary
Found while manually testing the reporter dialog: clicking "PasteBin" disabled the button, showed "please wait", and never resolved either way.
PastebinUploadRunnable.call()makes a real HTTP POST viajpastebinwith no timeout of its own, andUploadPanel.upload()just ran it on a bare thread and waited unboundedly forcallable.call()to return - a slow or unreachable server left no way to tell "still working" from "will never finish".upload()now submits to anExecutorServiceand waits at most 30s (configurable via a package-private constructor for tests) viafuture.get(timeout, SECONDS), cancelling the future and reporting a clear "Upload timed out after 30s" failure if it's not done by then.The wait-and-dispatch logic is split into a small static method,
awaitUpload(), that's plainFuture/Consumerplumbing with no Swing dependency - letsUploadPanelTestexercise the timeout, success, and underlying-failure-unwrapped-from-ExecutionExceptionpaths directly against realFutures, without a button-click harness.Test plan
UploadPanelTest- a deliberately-slowCallabletimes out and reports a clearIOException(not a hang); a fast one reports success; aCallablethrowing surfaces the real exception, notExecutionException's wrapper../gradlew build- clean.Related
merge-train.