@@ -587,14 +587,9 @@ class TransactionsTest extends IntegrationTestHarness {
587
587
fail(" Should not be able to send messages from a fenced producer." )
588
588
} catch {
589
589
case _ : InvalidProducerEpochException =>
590
- case e : ExecutionException => {
591
- if (quorum == " zk" ) {
592
- assertTrue(e.getCause.isInstanceOf [ProducerFencedException ])
593
- } else {
594
- // In kraft mode, transactionV2 is used.
595
- assertTrue(e.getCause.isInstanceOf [InvalidProducerEpochException ])
596
- }
597
- }
590
+ case e : ExecutionException =>
591
+ // In kraft mode, transactionV2 is used.
592
+ assertTrue(e.getCause.isInstanceOf [InvalidProducerEpochException ])
598
593
case e : Exception =>
599
594
throw new AssertionError (" Got an unexpected exception from a fenced producer." , e)
600
595
}
@@ -622,27 +617,14 @@ class TransactionsTest extends IntegrationTestHarness {
622
617
// Wait for the expiration cycle to kick in.
623
618
Thread .sleep(600 )
624
619
625
- if (quorum == " zk" ) {
626
- // In zk mode, transaction v1 is used.
627
- try {
628
- // Now that the transaction has expired, the second send should fail with a ProducerFencedException.
629
- producer.send(TestUtils .producerRecordWithExpectedTransactionStatus(topic1, null , " 2" , " 2" , willBeCommitted = false )).get()
630
- fail(" should have raised a ProducerFencedException since the transaction has expired" )
631
- } catch {
632
- case _ : ProducerFencedException =>
633
- case e : ExecutionException =>
634
- assertTrue(e.getCause.isInstanceOf [ProducerFencedException ])
635
- }
636
- } else {
637
- try {
638
- // Now that the transaction has expired, the second send should fail with a InvalidProducerEpochException.
639
- producer.send(TestUtils .producerRecordWithExpectedTransactionStatus(topic1, null , " 2" , " 2" , willBeCommitted = false )).get()
640
- fail(" should have raised a InvalidProducerEpochException since the transaction has expired" )
641
- } catch {
642
- case _ : InvalidProducerEpochException =>
643
- case e : ExecutionException =>
644
- assertTrue(e.getCause.isInstanceOf [InvalidProducerEpochException ])
645
- }
620
+ try {
621
+ // Now that the transaction has expired, the second send should fail with a InvalidProducerEpochException.
622
+ producer.send(TestUtils .producerRecordWithExpectedTransactionStatus(topic1, null , " 2" , " 2" , willBeCommitted = false )).get()
623
+ fail(" should have raised a InvalidProducerEpochException since the transaction has expired" )
624
+ } catch {
625
+ case _ : InvalidProducerEpochException =>
626
+ case e : ExecutionException =>
627
+ assertTrue(e.getCause.isInstanceOf [InvalidProducerEpochException ])
646
628
}
647
629
648
630
// Verify that the first message was aborted and the second one was never written at all.
0 commit comments