kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbej...@apache.org
Subject [kafka] branch 2.4 updated: MINOR: Fix failing test case in TransactionLogTest (#7895)
Date Thu, 05 Mar 2020 01:01:12 GMT
This is an automated email from the ASF dual-hosted git repository.

bbejeck pushed a commit to branch 2.4
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.4 by this push:
     new c2d4188  MINOR: Fix failing test case in TransactionLogTest (#7895)
c2d4188 is described below

commit c2d41888d69989dca12b27ccf8cab25ade5844eb
Author: Jason Gustafson <jason@confluent.io>
AuthorDate: Mon Jan 6 09:06:11 2020 -0800

    MINOR: Fix failing test case in TransactionLogTest (#7895)
    
    This patch fixes a brittle expectation on the `toString` implementation coming from `Set`.
This was failing on jenkins with the following error:
    ```
    java.lang.AssertionError: expected:<Some(producerId:1334,producerEpoch:0,state=Ongoing,partitions=Set(topic-0),txnLastUpdateTimestamp=0,txnTimeoutMs=1000)>
but was:<Some(producerId:1334,producerEpoch:0,state=Ongoing,partitions=HashSet(topic-0),txnLastUpdateTimestamp=0,txnTimeoutMs=1000)>
    ```
    Instead we convert the collection to a string directly.
    
    Reviewers: Boyang Chen <boyang@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>
---
 core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala  | 2 +-
 .../scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala b/core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala
index 7c7d055..2109095 100644
--- a/core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala
+++ b/core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala
@@ -281,7 +281,7 @@ object TransactionLog {
       case Some(txnMetadata) => s"producerId:${txnMetadata.producerId}," +
         s"producerEpoch:${txnMetadata.producerEpoch}," +
         s"state=${txnMetadata.state}," +
-        s"partitions=${txnMetadata.topicPartitions}," +
+        s"partitions=${txnMetadata.topicPartitions.mkString("[", ",", "]")}," +
         s"txnLastUpdateTimestamp=${txnMetadata.txnLastUpdateTimestamp}," +
         s"txnTimeoutMs=${txnMetadata.txnTimeoutMs}"
     }
diff --git a/core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala
b/core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala
index e9bf6d5..e9bdf31 100644
--- a/core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala
+++ b/core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala
@@ -123,7 +123,7 @@ class TransactionLogTest {
     val (keyStringOpt, valueStringOpt) = TransactionLog.formatRecordKeyAndValue(transactionMetadataRecord)
     assertEquals(Some(s"transaction_metadata::transactionalId=$transactionalId"), keyStringOpt)
     assertEquals(Some(s"producerId:$producerId,producerEpoch:$producerEpoch,state=Ongoing,"
+
-      s"partitions=Set($topicPartition),txnLastUpdateTimestamp=0,txnTimeoutMs=$transactionTimeoutMs"),
valueStringOpt)
+      s"partitions=[$topicPartition],txnLastUpdateTimestamp=0,txnTimeoutMs=$transactionTimeoutMs"),
valueStringOpt)
   }
 
   @Test


Mime
View raw message