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/16 16:50:18 UTC

[GitHub] [kafka] bertber opened a new pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

bertber opened a new pull request #9761:
URL: https://github.com/apache/kafka/pull/9761


   I made a test for ByteBufferInputStream in the ByteBufferLogInputStreamTest.
   First, I add a ByteBuffer that it's not empty to the ByteBufferInputStream, in order to verify it.
   After that, I try to use ByteBufferInputStream's read function and check return value whether it's correct.
   
   *More detailed description of your change,
   if necessary. The PR title and PR message become
   the squashed commit message, so use a separate
   comment to ping reviewers.*
   
   *Summary of testing strategy (including rationale)
   for the feature or bug fix. Unit and/or integration
   tests are expected for any behaviour change and
   system tests should be considered for larger changes.*
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
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 #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/record/ByteBufferLogInputStreamTest.java
##########
@@ -120,4 +121,26 @@ public void iteratorRaisesOnTooLargeRecords() {
         logInputStream.nextBatch();
     }
 
+    @Test
+    public void testReadUnsignedIntFromInputStream() {

Review comment:
       Could you move the tests to ```ByteBufferInputStreamTest```? If there is no such test class, feel free to create new one.




----------------------------------------------------------------
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 #9761: KAFKA-10768 Make ByteBufferInputStream.read(byte[], int, int) to follow the contract

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


   


----------------------------------------------------------------
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 #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/utils/ByteBufferInputStreamTest.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.common.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+
+import org.junit.Test;
+
+public class ByteBufferInputStreamTest {
+
+    @Test
+    public void testReadUnsignedIntFromInputStream() throws Exception {

Review comment:
       ```throws Exception ``` is useless.




----------------------------------------------------------------
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] bertber edited a comment on pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

Posted by GitBox <gi...@apache.org>.
bertber edited a comment on pull request #9761:
URL: https://github.com/apache/kafka/pull/9761#issuecomment-748028169


   > Is `kafka.server.ControllerMutationQuotaTest.testPermissiveDeleteTopicsRequest` related to this PR?
   
   No, I don't think it is related to this PR.


----------------------------------------------------------------
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 #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/record/ByteBufferLogInputStreamTest.java
##########
@@ -119,5 +119,4 @@ public void iteratorRaisesOnTooLargeRecords() {
         assertNotNull(logInputStream.nextBatch());
         logInputStream.nextBatch();
     }
-

Review comment:
       please revert this change.




----------------------------------------------------------------
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 pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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


   @bertber Please take a look at origin PR (https://github.com/apache/kafka/pull/3752/files#diff-ae627decd5dd27d053a7a9b051860f60df6b89c8884e50df2f9ae0de6a4645e5R40). It would be better to fix the scenario of 'len==0'.


----------------------------------------------------------------
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] bertber commented on pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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


   > Is `kafka.server.ControllerMutationQuotaTest.testPermissiveDeleteTopicsRequest` related to this PR?
   
   Yes, I think it is related to this PR.


----------------------------------------------------------------
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] bertber commented on a change in pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/utils/ByteBufferInputStreamTest.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.common.utils;
+
+import static org.junit.Assert.assertEquals;

Review comment:
       I have put the java behind the org




----------------------------------------------------------------
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 pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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


   Is ```kafka.server.ControllerMutationQuotaTest.testPermissiveDeleteTopicsRequest``` related to this PR?


----------------------------------------------------------------
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] bertber commented on a change in pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/utils/ByteBufferInputStreamTest.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.common.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+
+import org.junit.Test;
+
+public class ByteBufferInputStreamTest {
+
+    @Test
+    public void testReadUnsignedIntFromInputStream() throws Exception {

Review comment:
       It have been removed.




----------------------------------------------------------------
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 #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/utils/ByteBufferInputStreamTest.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.common.utils;
+
+import static org.junit.Assert.assertEquals;

Review comment:
       We have a pending PR offering a consistent import order (see https://github.com/apache/kafka/pull/8404#discussion_r535791013). Could you please follow the rules (although it is not merged)?
   
   1. kafka, org.apache.kafka
   1. com, net, org
   1. java, javax




----------------------------------------------------------------
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] bertber commented on a change in pull request #9761: KAFKA-10768 Add a test for ByteBufferInputStream to ByteBufferLogInputStreamTest

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



##########
File path: clients/src/test/java/org/apache/kafka/common/record/ByteBufferLogInputStreamTest.java
##########
@@ -119,5 +119,4 @@ public void iteratorRaisesOnTooLargeRecords() {
         assertNotNull(logInputStream.nextBatch());
         logInputStream.nextBatch();
     }
-

Review comment:
       This change have been reverted.




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