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 2022/12/22 17:02:58 UTC

[GitHub] [kafka] gharris1727 commented on a diff in pull request #13036: KAFKA-14534: Reduce flakiness in TransactionsExpirationTest

gharris1727 commented on code in PR #13036:
URL: https://github.com/apache/kafka/pull/13036#discussion_r1055666985


##########
core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala:
##########
@@ -128,10 +128,13 @@ class TransactionsExpirationTest extends KafkaServerTestHarness {
     producer.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic1, 0, "2", "2", willBeCommitted = false))
     producer.flush()
 
+    TestUtils.waitUntilTrue(() => producerState.nonEmpty, s"Producer IDs for topic1 did not propagate quickly")
+
     // Ensure producer IDs are added.
     val pState = producerState
-    assertEquals(1, pState.size)
-    val oldProducerId = pState(0).producerId
+    assertEquals(1, pState.size, s"No producer visible via admin api")

Review Comment:
   > I don't think the error message makes sense here since we already wait until the producerState is not empty.
   
   Because we're calling producerState a second time, we might actually get a 0-size list here (or any size, but a rogue producer making the size >1 would be quite unusual.)
   
   Having the message complain about the size mismatch seems less helpful than a message indicating what the reason for the mismatch actually is.
   
   This assertion is just here to cover a race condition in the test, so I'll remove the race condition and replace this with a more accurate assertion error message.



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

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

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