MINOR: Fix always-passing validation in TestRecordTest#testProducerRecord#9930
MINOR: Fix always-passing validation in TestRecordTest#testProducerRecord#9930chia7712 merged 1 commit intoapache:trunkfrom
Conversation
chia7712
left a comment
There was a problem hiding this comment.
@dongjinleekr Thanks for your patch!
There was a problem hiding this comment.
Could we separate this assert by assertEquals? It can produce more meaningful error message.
There was a problem hiding this comment.
Also, it should make sure the input arguments (from ProducerRecord) are equals to getter of TestRecord. For example:
assertEquals(expectedRecord.getHeaders(), producerRecord.headers())There was a problem hiding this comment.
@chia7712 Sorry for the confusion. Since expectedRecord is logically identical to testRecord and producerRecord is created fro testRecord, expectedRecord and testRecord are logically equal. The reason why the previous assertion was always true was not for its logical state, but the difference between their classes - ProducerRecord vs. TestRecord.
So, after some thought, I concluded that just removing the meaningless assertion is enough. Here is the update.
There was a problem hiding this comment.
Is the assert intentional? If so, we should keep it and then add clear comments to avoid confusing readers in the future.
WDYT?
There was a problem hiding this comment.
Is the assert intentional?
It seems not. If it was interntional, the same statement must be included in its consumer-side counterpart test method, testConsumerRecord, which is actually not.
5b53c4e to
b1c565d
Compare
chia7712
left a comment
There was a problem hiding this comment.
@dongjinleekr Thanks for your patch. LGTM. will commit it tomorrow.
b1c565d to
07ed4ed
Compare
|
ping @chia7712 |
|
@dongjinleekr Please take a look at this comment (#9930 (comment)) |
|
Good job, @chia7712! ㊗️ |
…e-allocations-lz4 * apache-github/trunk: (118 commits) KAFKA-12327: Remove MethodHandle usage in CompressionType (apache#10123) KAFKA-12297: Make MockProducer return RecordMetadata with values as per contract MINOR: Update zstd and use classes with no finalizers (apache#10120) KAFKA-12326: Corrected regresion in MirrorMaker 2 executable introduced with KAFKA-10021 (apache#10122) KAFKA-12321 the comparison function for uuid type should be 'equals' rather than '==' (apache#10098) MINOR: Add FetchSnapshot API doc in KafkaRaftClient (apache#10097) MINOR: KIP-631 KafkaConfig fixes and improvements (apache#10114) KAFKA-12272: Fix commit-interval metrics (apache#10102) MINOR: Improve confusing admin client shutdown logging (apache#10107) MINOR: Add BrokerMetadataListener (apache#10111) MINOR: Support Raft-based metadata quorums in system tests (apache#10093) MINOR: add the MetaLogListener, LocalLogManager, and Controller interface. (apache#10106) MINOR: Introduce the KIP-500 Broker lifecycle manager (apache#10095) MINOR: Remove always-passing validation in TestRecordTest#testProducerRecord (apache#9930) KAFKA-5235: GetOffsetShell: Support for multiple topics and consumer configuration override (KIP-635) (apache#9430) MINOR: Prevent creating partition.metadata until ID can be written (apache#10041) MINOR: Add RaftReplicaManager (apache#10069) MINOR: Add ClientQuotaMetadataManager for processing QuotaRecord (apache#10101) MINOR: Rename DecommissionBrokers to UnregisterBrokers (apache#10084) MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference (apache#10080) ... clients/src/main/java/org/apache/kafka/common/record/CompressionType.java core/src/test/scala/unit/kafka/coordinator/group/GroupMetadataManagerTest.scala
Since the types of
ProducerRecordandTestRecordare different, callingassertNotEqualsfor these instances always succeeds - and meaningless.This commit improves
TestRecordTestby comparing the instances deeply.cc/ @chia7712
Committer Checklist (excluded from commit message)