Fix CI failure in TestJettyHttpsClientSpnego.testNegotiateAuthScheme#130
Fix CI failure in TestJettyHttpsClientSpnego.testNegotiateAuthScheme#130nishithakbhaskaran wants to merge 1 commit into
Conversation
9eee3c1 to
609aa16
Compare
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR resolves a CI failure by updating the test annotation for testNegotiateAuthScheme so that it expects a RuntimeException with the correct message pattern instead of UncheckedIOException. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Use a more specific exception type for SPNEGO authentication failures rather than the generic RuntimeException to make error handling clearer.
- Add a brief comment in the test explaining why the expected exception was changed to RuntimeException to document this behavioral change.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Use a more specific exception type for SPNEGO authentication failures rather than the generic RuntimeException to make error handling clearer.
- Add a brief comment in the test explaining why the expected exception was changed to RuntimeException to document this behavioral change.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| } | ||
|
|
||
| @Test(expectedExceptions = UncheckedIOException.class, expectedExceptionsMessageRegExp = ".* Failed to establish LoginContext for request .*") | ||
| @Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = ".*Failed to establish LoginContext for request .*") |
There was a problem hiding this comment.
The new exception is (correctly) a RuntimeException -
java.lang.RuntimeException: Failed to establish LoginContext for request https://localhost:39313/
at com.facebook.airlift.http.client.spnego.SpnegoAuthentication$1.authenticate(SpnegoAuthentication.java:168)
at com.facebook.airlift.http.client.spnego.SpnegoAuthentication$1.lambda$apply$0(SpnegoAuthentication.java:133)
at net.jodah.failsafe.Functions.lambda$supplierOf$12(Functions.java:296)
at net.jodah.failsafe.Functions.lambda$resultSupplierOf$11(Functions.java:283)
at net.jodah.failsafe.internal.executor.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:67)
at net.jodah.failsafe.Execution.executeSync(Execution.java:117)
at net.jodah.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:319)
at net.jodah.failsafe.FailsafeExecutor.run(FailsafeExecutor.java:219)
at com.facebook.airlift.http.client.spnego.SpnegoAuthentication$1.apply(SpnegoAuthentication.java:133)
at org.eclipse.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:226)
at com.facebook.airlift.http.client.spnego.ForwardingResponseListener.onComplete(ForwardingResponseListener.java:68)
at com.facebook.airlift.http.client.spnego.SpnegoAuthenticationProtocolHandler$1.onComplete(SpnegoAuthenticationProtocolHandler.java:52)
at org.eclipse.jetty.client.transport.ResponseListeners.notifyComplete(ResponseListeners.java:354)
at org.eclipse.jetty.client.transport.ResponseListeners.notifyComplete(ResponseListeners.java:346)
at org.eclipse.jetty.client.transport.HttpReceiver.terminateResponse(HttpReceiver.java:454)
at org.eclipse.jetty.client.transport.HttpReceiver.terminateResponse(HttpReceiver.java:436)
at org.eclipse.jetty.client.transport.HttpReceiver.lambda$responseSuccess$4(HttpReceiver.java:394)
at org.eclipse.jetty.util.thread.SerializedInvoker$Link.run(SerializedInvoker.java:274)
at org.eclipse.jetty.util.thread.SerializedInvoker.run(SerializedInvoker.java:174)
at org.eclipse.jetty.client.transport.HttpReceiver.responseHeaders(HttpReceiver.java:247)
at org.eclipse.jetty.client.transport.internal.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:335)
at org.eclipse.jetty.client.transport.internal.HttpReceiverOverHTTP.parseAndFill(HttpReceiverOverHTTP.java:252)
at org.eclipse.jetty.client.transport.internal.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:85)
at org.eclipse.jetty.client.transport.internal.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:97)
at org.eclipse.jetty.client.transport.internal.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:267)
at org.eclipse.jetty.client.transport.internal.HttpConnectionOverHTTP$FillableCallback.succeeded(HttpConnectionOverHTTP.java:458)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ssl.SslConnection$SslEndPoint.onFillable(SslConnection.java:614)
at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:415)
at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:156)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:54)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:521)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.epcRunTask(AdaptiveExecutionStrategy.java:492)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:447)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:297)
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:202)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:312)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:1009)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1239)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1194)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: javax.security.auth.login.LoginException: KrbException: Cannot locate default realm
at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:633)
at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:597)
at java.base/javax.security.auth.login.LoginContext.invoke(LoginContext.java:755)
at java.base/javax.security.auth.login.LoginContext$4.run(LoginContext.java:679)
at java.base/javax.security.auth.login.LoginContext$4.run(LoginContext.java:677)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:677)
at java.base/javax.security.auth.login.LoginContext.login(LoginContext.java:587)
at com.facebook.airlift.http.client.spnego.SpnegoAuthentication.getSession(SpnegoAuthentication.java:236)
at com.facebook.airlift.http.client.spnego.SpnegoAuthentication$1.authenticate(SpnegoAuthentication.java:141)
... 41 more
Caused by: KrbException: KrbException: Cannot locate default realm
at java.security.jgss/sun.security.krb5.Realm.getDefault(Realm.java:66)
at java.security.jgss/sun.security.krb5.PrincipalName.<init>(PrincipalName.java:479)
at java.security.jgss/sun.security.krb5.PrincipalName.<init>(PrincipalName.java:489)
at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:630)
... 50 more
Caused by: KrbException: Cannot locate default realm
at java.security.jgss/sun.security.krb5.Config.getDefaultRealm(Config.java:1219)
at java.security.jgss/sun.security.krb5.Realm.getDefault(Realm.java:62)
... 53 more
Can you do some testing as to why this was an UncheckedIOException before ? I suspect the call flow has changed, and it would be good to know why
There was a problem hiding this comment.
I could see the CI is passing before merging #128. So I suspect the issue has been brought in by the same.
Upgrading jetty from 12.0.18 to 12.1.1 has introduced changes in some threading / async I guess.
52d3947 to
efd2d61
Compare
|
FYI. Test case failure caused by an upstream Jetty behavior change - The change came as part of
thus earlier the test case was passing but post this change RuntimeException is directly thrown leads to test case failure. As a fix, the expected exception is changed from |
Fix CI Failure in testNegotiateAuthScheme()
Fixes https://github.com/prestodb/airlift/actions/runs/19124887710/job/54653069038?pr=129