You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "seokmo-yoo-dev (via GitHub)" <gi...@apache.org> on 2026/10/29 05:29:05 UTC

[PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

seokmo-yoo-dev opened a new pull request, #24007:
URL: https://github.com/apache/kafka/pull/24007

   Replace the remaining try/fail/catch blocks in the SASL client tests
   with `assertThrows`, following the same cleanup already done for the
   producer, Streams and Connect tests.
   
   - `SaslAuthenticatorTest#testInvalidMechanism`
   - `OAuthBearerSaslClientTest#testWrapsExtensionsCallbackHandlingErrorInSaslExceptionInFirstClientMessage`
   
   The assertions on the thrown exception are unchanged.
   
   ### Testing
   
   ```
   ./gradlew :clients:test --tests '*SaslAuthenticatorTest.testInvalidMechanism' --tests '*OAuthBearerSaslClientTest'
   ./gradlew :clients:checkstyleTest :clients:spotlessCheck
   ```
   


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "m1a2st (via GitHub) via jira" <ji...@kafka.apache.org>.
m1a2st merged PR #24007:
URL: https://github.com/apache/kafka/pull/24007


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "github-actions[bot] (via GitHub) via jira" <ji...@kafka.apache.org>.
github-actions[bot] commented on PR #24007:
URL: https://github.com/apache/kafka/pull/24007#issuecomment-6842690905

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "seokmo-yoo-dev (via GitHub) via jira" <ji...@kafka.apache.org>.
seokmo-yoo-dev commented on PR #24007:
URL: https://github.com/apache/kafka/pull/24007#issuecomment-6567520648

   @m1a2st Hi, you merged #23746 in the same test class, so I thought you might be the right person for this one.
   It's a small cleanup in SaslAuthenticatorTest and OAuthBearerSaslClientTest, replacing try/fail/catch with assertThrows.
   Could you approve the CI run when you have a moment? I'm a first-time contributor, so the workflow is waiting on that.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "m1a2st (via GitHub) via jira" <ji...@kafka.apache.org>.
m1a2st commented on code in PR #24007:
URL: https://github.com/apache/kafka/pull/24007#discussion_r4572113054


##########
clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorTest.java:
##########
@@ -1287,9 +1286,7 @@ public void testInvalidMechanism() throws Exception {
 
         server = createEchoServer(securityProtocol);
         try {
-            createAndCheckClientConnectionFailure(securityProtocol, node);
-            fail("Did not generate exception prior to creating channel");
-        } catch (IOException expected) {
+            IOException expected = assertThrows(IOException.class, () -> createAndCheckClientConnectionFailure(securityProtocol, node));

Review Comment:
   Could you keep the original fail message?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "seokmo-yoo-dev (via GitHub) via jira" <ji...@kafka.apache.org>.
seokmo-yoo-dev commented on code in PR #24007:
URL: https://github.com/apache/kafka/pull/24007#discussion_r4581654218


##########
clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorTest.java:
##########
@@ -1287,9 +1286,7 @@ public void testInvalidMechanism() throws Exception {
 
         server = createEchoServer(securityProtocol);
         try {
-            createAndCheckClientConnectionFailure(securityProtocol, node);
-            fail("Did not generate exception prior to creating channel");
-        } catch (IOException expected) {
+            IOException expected = assertThrows(IOException.class, () -> createAndCheckClientConnectionFailure(securityProtocol, node));

Review Comment:
   Hi @m1a2st , thank you for your review! 👍 
   I changed the code to keep the original fail message,
   including the same pattern in `OAuthBearerSaslClientTest`.
   CI will be soon re-runned.
   
   - commit: https://github.com/apache/kafka/pull/24007/changes/2851bf79a5c4fcf153bb45c9dc31badcf98d484f



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "github-actions[bot] (via GitHub) via jira" <ji...@kafka.apache.org>.
github-actions[bot] commented on PR #24007:
URL: https://github.com/apache/kafka/pull/24007#issuecomment-6701485444

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Replace try/fail/catch with assertThrows in SASL client tests [kafka]

Posted by "seokmo-yoo-dev (via GitHub) via jira" <ji...@kafka.apache.org>.
seokmo-yoo-dev commented on code in PR #24007:
URL: https://github.com/apache/kafka/pull/24007#discussion_r4581654218


##########
clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorTest.java:
##########
@@ -1287,9 +1286,7 @@ public void testInvalidMechanism() throws Exception {
 
         server = createEchoServer(securityProtocol);
         try {
-            createAndCheckClientConnectionFailure(securityProtocol, node);
-            fail("Did not generate exception prior to creating channel");
-        } catch (IOException expected) {
+            IOException expected = assertThrows(IOException.class, () -> createAndCheckClientConnectionFailure(securityProtocol, node));

Review Comment:
   Hi @m1a2st , thank you for your review! 👍 
   I changed the code to keep the original fail message,
   including the same pattern in `OAuthBearerSaslClientTest`.
   CI will be soon re-runned.
   If two commits should be one commit and force-pushed, please let me know. 🙏 
   
   - commit: https://github.com/apache/kafka/pull/24007/changes/2851bf79a5c4fcf153bb45c9dc31badcf98d484f



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org