You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/22 06:10:58 UTC

[GitHub] [kafka] g1geordie opened a new pull request #9776: KAFKA-10878 Check failed message in ProtocolSerializationTest

g1geordie opened a new pull request #9776:
URL: https://github.com/apache/kafka/pull/9776


   use assert to check failed message 
   
   -  testReadWhenOptionalDataMissingAtTheEndIsNotTolerated
   -  testReadWithMissingNonOptionalExtraDataAtTheEnd 


----------------------------------------------------------------
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.

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



[GitHub] [kafka] chia7712 merged pull request #9776: KAFKA-10878 Check failed message in ProtocolSerializationTest

Posted by GitBox <gi...@apache.org>.
chia7712 merged pull request #9776:
URL: https://github.com/apache/kafka/pull/9776


   


----------------------------------------------------------------
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.

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



[GitHub] [kafka] g1geordie commented on pull request #9776: KAFKA-10878 Check failed message in ProtocolSerializationTest

Posted by GitBox <gi...@apache.org>.
g1geordie commented on pull request #9776:
URL: https://github.com/apache/kafka/pull/9776#issuecomment-749685362


   @chia7712  can you help my take a look?


----------------------------------------------------------------
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.

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



[GitHub] [kafka] chia7712 commented on a change in pull request #9776: KAFKA-10878 Check failed message in ProtocolSerializationTest

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #9776:
URL: https://github.com/apache/kafka/pull/9776#discussion_r548375460



##########
File path: clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
##########
@@ -414,7 +416,7 @@ public void testReadWhenOptionalDataMissingAtTheEndIsNotTolerated() {
         oldFormat.writeTo(buffer);
         buffer.flip();
         SchemaException e = assertThrows(SchemaException.class, () -> newSchema.read(buffer));
-        e.getMessage().contains("Error reading field 'field2': java.nio.BufferUnderflowException");
+        assertThat(e.getMessage(), containsString("Error reading field 'field2': java.nio.BufferUnderflowException"));

Review comment:
       You are right. Checking ```Error reading field 'field2'``` should be enough for this test case.




----------------------------------------------------------------
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.

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



[GitHub] [kafka] chia7712 commented on a change in pull request #9776: KAFKA-10878 Check failed message in ProtocolSerializationTest

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #9776:
URL: https://github.com/apache/kafka/pull/9776#discussion_r548031919



##########
File path: clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
##########
@@ -414,7 +416,7 @@ public void testReadWhenOptionalDataMissingAtTheEndIsNotTolerated() {
         oldFormat.writeTo(buffer);
         buffer.flip();
         SchemaException e = assertThrows(SchemaException.class, () -> newSchema.read(buffer));
-        e.getMessage().contains("Error reading field 'field2': java.nio.BufferUnderflowException");
+        assertThat(e.getMessage(), containsString("Error reading field 'field2': java.nio.BufferUnderflowException"));

Review comment:
       Is this error message from java standard library? If so, does it got different on different location (i.e different language)? 




----------------------------------------------------------------
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.

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



[GitHub] [kafka] g1geordie commented on a change in pull request #9776: KAFKA-10878 Check failed message in ProtocolSerializationTest

Posted by GitBox <gi...@apache.org>.
g1geordie commented on a change in pull request #9776:
URL: https://github.com/apache/kafka/pull/9776#discussion_r548375097



##########
File path: clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
##########
@@ -414,7 +416,7 @@ public void testReadWhenOptionalDataMissingAtTheEndIsNotTolerated() {
         oldFormat.writeTo(buffer);
         buffer.flip();
         SchemaException e = assertThrows(SchemaException.class, () -> newSchema.read(buffer));
-        e.getMessage().contains("Error reading field 'field2': java.nio.BufferUnderflowException");
+        assertThat(e.getMessage(), containsString("Error reading field 'field2': java.nio.BufferUnderflowException"));

Review comment:
       The SchemaException is throw by KAFKA. 
   it's message is  `fix string + field info   +  e.msg || e.className` 
   the lastest string here is className   
   
   but It's seems to me that only check the prefix is more better 




----------------------------------------------------------------
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.

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