Browse Source

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>
pull/7900/head
Jason Gustafson 5 years ago committed by GitHub
parent
commit
bd3bde7623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala
  2. 2
      core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala

2
core/src/main/scala/kafka/coordinator/transaction/TransactionLog.scala

@ -281,7 +281,7 @@ object TransactionLog { @@ -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}"
}

2
core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala

@ -123,7 +123,7 @@ class TransactionLogTest { @@ -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

Loading…
Cancel
Save