testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

Fixes the issue of missing root cause in container launch TimeoutException (e.g. SSLHandshakeException)

Open cdanger opened this issue 3 years ago • 2 comments

Fixes the issue of root causes not propagated to container launch TimeoutException; e.g. when applying a HttpWaitStrategy with TLS enabled (HTTPS), if HTTPS connection check fails because of certificate validation issue (e.g. javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target), this exception is not propagated, therefor missing from the logs and the TimeoutException thrown at the end. The only wait to know about it is by using a debugger. The fix just adds the causing exception to the ContainerLaunchException, so that it's part of the TimeoutException stacktrace later on.

cdanger avatar Aug 27 '22 20:08 cdanger

Thanks for the PR @cdanger, a really good addition for the DX.

Could you please look into adding a test for this behavior? Maybe it is also fine to add it to the existing waitUntilReadyAndTimeout check, or maybe an additional test needs to be added.

kiview avatar Aug 29 '22 10:08 kiview

Could you please look into adding a test for this behavior? Maybe it is also fine to add it to the existing waitUntilReadyAndTimeout check, or maybe an additional test needs to be added.

OK I added a new commit with a new test for this in the HttpWaitStrategyTest class: testWaitUntilReadyWithTimeoutCausedBySslHandshakeError() .

cdanger avatar Aug 31 '22 23:08 cdanger

Waiting on code owner review...

cdanger avatar Oct 08 '22 16:10 cdanger

@cdanger Do you want to finish up this PR regarding our suggestions, or should we take care of it?

kiview avatar Nov 21 '22 15:11 kiview

@cdanger CI is failing because of spotless, can you please run ./gradlew :testcontainers:spotlessApply and commit the changes? 🙏

kiview avatar Nov 23 '22 11:11 kiview

Thanks @cdanger, merged 👍

kiview avatar Nov 28 '22 10:11 kiview