Class FetcherTest

java.lang.Object
org.apache.kafka.clients.consumer.internals.FetcherTest

public class FetcherTest extends Object
If you are adding a test here, do evaluate if a similar test needs to be added in FetchRequestManagerTest.java, which captures the tests for the new consumer as part of the https://cwiki.apache.org/confluence/display/KAFKA/Consumer+threading+refactor+project+overview
  • Constructor Details

    • FetcherTest

      public FetcherTest()
  • Method Details

    • setup

      @BeforeEach public void setup()
    • teardown

      @AfterEach public void teardown() throws Exception
      Throws:
      Exception
    • testFetchNormal

      @Test public void testFetchNormal()
    • testInflightFetchOnPendingPartitions

      @Test public void testInflightFetchOnPendingPartitions()
    • testCloseShouldBeIdempotent

      @Test public void testCloseShouldBeIdempotent()
    • testFetcherCloseClosesFetchSessionsInBroker

      @Test public void testFetcherCloseClosesFetchSessionsInBroker()
    • testFetchingPendingPartitions

      @Test public void testFetchingPendingPartitions()
    • testFetchWithNoTopicId

      @Test public void testFetchWithNoTopicId()
    • testFetchWithTopicId

      @Test public void testFetchWithTopicId()
    • testFetchForgetTopicIdWhenUnassigned

      @Test public void testFetchForgetTopicIdWhenUnassigned()
    • testFetchForgetTopicIdWhenReplaced

      @Test public void testFetchForgetTopicIdWhenReplaced()
    • testFetchTopicIdUpgradeDowngrade

      @Test public void testFetchTopicIdUpgradeDowngrade()
    • testMissingLeaderEpochInRecords

      @Test public void testMissingLeaderEpochInRecords()
    • testLeaderEpochInConsumerRecord

      @Test public void testLeaderEpochInConsumerRecord()
    • testClearBufferedDataForTopicPartitions

      @Test public void testClearBufferedDataForTopicPartitions()
    • testFetchSkipsBlackedOutNodes

      @Test public void testFetchSkipsBlackedOutNodes()
    • testFetcherIgnoresControlRecords

      @Test public void testFetcherIgnoresControlRecords()
    • testFetchError

      @Test public void testFetchError()
    • testFetchedRecordsRaisesOnSerializationErrors

      @Test public void testFetchedRecordsRaisesOnSerializationErrors()
    • testParseCorruptedRecord

      @Test public void testParseCorruptedRecord() throws Exception
      Throws:
      Exception
    • testInvalidDefaultRecordBatch

      @Test public void testInvalidDefaultRecordBatch()
    • testParseInvalidRecordBatch

      @Test public void testParseInvalidRecordBatch()
    • testHeaders

      @Test public void testHeaders()
    • testFetchMaxPollRecords

      @Test public void testFetchMaxPollRecords()
    • testFetchMaxPollRecordsUnaligned

      @Test public void testFetchMaxPollRecordsUnaligned()
      KAFKA-15836: Test that max.poll.records is honoured when consuming from multiple topic-partitions and the fetched records are not aligned on max.poll.records boundaries. tp0 has records 1,2,3; tp1 has records 6,7,8 max.poll.records is 2 poll 1 should return 1,2 poll 2 should return 3,6 poll 3 should return 7,8 Or it can be 6,7; then 8,1; then 2,3 because the order of topic-partitions returned is non-deterministic.
    • testFetchAfterPartitionWithFetchedRecordsIsUnassigned

      @Test public void testFetchAfterPartitionWithFetchedRecordsIsUnassigned()
      Test the scenario where a partition with fetched but not consumed records (i.e. max.poll.records is less than the number of fetched records) is unassigned and a different partition is assigned. This is a pattern used by Streams state restoration and KAFKA-5097 would have been caught by this test.
    • testFetchNonContinuousRecords

      @Test public void testFetchNonContinuousRecords()
    • testFetchRequestInternalError

      @Test public void testFetchRequestInternalError()
      Test the case where the client makes a post KIP-74 FetchRequest, but the server replies with only a partial request. For v3 and later FetchRequests, the implementation of KIP-74 changed the behavior so that at least one message is always returned. Therefore, this case should not happen, and it indicates that an internal error has taken place.
    • testUnauthorizedTopic

      @Test public void testUnauthorizedTopic()
    • testFetchDuringEagerRebalance

      @Test public void testFetchDuringEagerRebalance()
    • testFetchDuringCooperativeRebalance

      @Test public void testFetchDuringCooperativeRebalance()
    • testInFlightFetchOnPausedPartition

      @Test public void testInFlightFetchOnPausedPartition()
    • testFetchOnPausedPartition

      @Test public void testFetchOnPausedPartition()
    • testFetchOnCompletedFetchesForPausedAndResumedPartitions

      @Test public void testFetchOnCompletedFetchesForPausedAndResumedPartitions()
    • testFetchOnCompletedFetchesForSomePausedPartitions

      @Test public void testFetchOnCompletedFetchesForSomePausedPartitions()
    • testFetchOnCompletedFetchesForAllPausedPartitions

      @Test public void testFetchOnCompletedFetchesForAllPausedPartitions()
    • testPartialFetchWithPausedPartitions

      @Test public void testPartialFetchWithPausedPartitions()
    • testFetchDiscardedAfterPausedPartitionResumedAndSoughtToNewOffset

      @Test public void testFetchDiscardedAfterPausedPartitionResumedAndSoughtToNewOffset()
    • testRecordLatencyOnFetchResponseLevelError

      @Test public void testRecordLatencyOnFetchResponseLevelError()
    • testHandleFetchResponseError

      @ParameterizedTest @MethodSource("handleFetchResponseErrorSupplier") public void testHandleFetchResponseError(org.apache.kafka.common.protocol.Errors error, long highWatermark, boolean hasTopLevelError, boolean shouldRequestMetadataUpdate)
    • testEpochSetInFetchRequest

      @Test public void testEpochSetInFetchRequest()
    • testFetchOffsetOutOfRange

      @Test public void testFetchOffsetOutOfRange()
    • testStaleOutOfRangeError

      @Test public void testStaleOutOfRangeError()
    • testFetchedRecordsAfterSeek

      @Test public void testFetchedRecordsAfterSeek()
    • testFetchOffsetOutOfRangeException

      @Test public void testFetchOffsetOutOfRangeException()
    • testFetchPositionAfterException

      @Test public void testFetchPositionAfterException()
    • testCompletedFetchRemoval

      @Test public void testCompletedFetchRemoval()
    • testSeekBeforeException

      @Test public void testSeekBeforeException()
    • testFetchDisconnected

      @Test public void testFetchDisconnected()
    • testQuotaMetrics

      @Test public void testQuotaMetrics()
    • testFetcherMetrics

      @Test public void testFetcherMetrics()
    • testFetcherLeadMetric

      @Test public void testFetcherLeadMetric()
    • testReadCommittedLagMetric

      @Test public void testReadCommittedLagMetric()
    • testFetchResponseMetrics

      @Test public void testFetchResponseMetrics()
    • testFetchResponseMetricsWithSkippedOffset

      @Test public void testFetchResponseMetricsWithSkippedOffset()
    • testFetchResponseMetricsWithOnePartitionError

      @Test public void testFetchResponseMetricsWithOnePartitionError()
    • testFetchResponseMetricsWithOnePartitionAtTheWrongOffset

      @Test public void testFetchResponseMetricsWithOnePartitionAtTheWrongOffset()
    • testFetcherMetricsTemplates

      @Test public void testFetcherMetricsTemplates()
    • testSkippingAbortedTransactions

      @Test public void testSkippingAbortedTransactions()
    • testReturnCommittedTransactions

      @Test public void testReturnCommittedTransactions()
    • testReadCommittedWithCommittedAndAbortedTransactions

      @Test public void testReadCommittedWithCommittedAndAbortedTransactions()
    • testMultipleAbortMarkers

      @Test public void testMultipleAbortMarkers()
    • testReadCommittedAbortMarkerWithNoData

      @Test public void testReadCommittedAbortMarkerWithNoData()
    • testUpdatePositionWithLastRecordMissingFromBatch

      @Test public void testUpdatePositionWithLastRecordMissingFromBatch()
    • testUpdatePositionOnEmptyBatch

      @Test public void testUpdatePositionOnEmptyBatch()
    • testReadCommittedWithCompactedTopic

      @Test public void testReadCommittedWithCompactedTopic()
    • testReturnAbortedTransactionsInUncommittedMode

      @Test public void testReturnAbortedTransactionsInUncommittedMode()
    • testConsumerPositionUpdatedWhenSkippingAbortedTransactions

      @Test public void testConsumerPositionUpdatedWhenSkippingAbortedTransactions()
    • testConsumingViaIncrementalFetchRequests

      @Test public void testConsumingViaIncrementalFetchRequests()
    • testFetcherConcurrency

      @Test public void testFetcherConcurrency() throws Exception
      Throws:
      Exception
    • testFetcherSessionEpochUpdate

      @Test public void testFetcherSessionEpochUpdate() throws Exception
      Throws:
      Exception
    • testEmptyControlBatch

      @Test public void testEmptyControlBatch()
    • testSubscriptionPositionUpdatedWithEpoch

      @Test public void testSubscriptionPositionUpdatedWithEpoch()
    • testTruncationDetected

      @Test public void testTruncationDetected()
    • testPreferredReadReplica

      @Test public void testPreferredReadReplica()
    • testFetchDisconnectedShouldClearPreferredReadReplica

      @Test public void testFetchDisconnectedShouldClearPreferredReadReplica()
    • testFetchDisconnectedShouldNotClearPreferredReadReplicaIfUnassigned

      @Test public void testFetchDisconnectedShouldNotClearPreferredReadReplicaIfUnassigned()
    • testFetchErrorShouldClearPreferredReadReplica

      @Test public void testFetchErrorShouldClearPreferredReadReplica()
    • testPreferredReadReplicaOffsetError

      @Test public void testPreferredReadReplicaOffsetError()
    • testFetchCompletedBeforeHandlerAdded

      @Test public void testFetchCompletedBeforeHandlerAdded()
    • testCorruptMessageError

      @Test public void testCorruptMessageError()
    • testWhenFetchResponseReturnsALeaderShipChangeErrorButNoNewLeaderInformation

      @ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"FENCED_LEADER_EPOCH","NOT_LEADER_OR_FOLLOWER"}) public void testWhenFetchResponseReturnsALeaderShipChangeErrorButNoNewLeaderInformation(org.apache.kafka.common.protocol.Errors error)
      Test the scenario that FetchResponse returns with an error indicating leadership change for the partition, but it does not contain new leader info(defined in KIP-951).
    • testWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInformation

      @ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"FENCED_LEADER_EPOCH","NOT_LEADER_OR_FOLLOWER"}) public void testWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInformation(org.apache.kafka.common.protocol.Errors error)
      Test the scenario that FetchResponse returns with an error indicating leadership change for the partition, along with new leader info(defined in KIP-951).
    • testFetcherDontCacheAnyData

      @Test public void testFetcherDontCacheAnyData()