AmatyaAvadhanula commented on a change in pull request #12235:
URL: https://github.com/apache/druid/pull/12235#discussion_r807613102
##########
File path:
extensions-core/kinesis-indexing-service/src/test/java/org/apache/druid/indexing/kinesis/KinesisRecordSupplierTest.java
##########
@@ -1023,4 +1024,61 @@ public void getPartitionTimeLag() throws
InterruptedException
}
verifyAll();
}
+
+ @Test
+ public void testIsClosedShardEmpty()
+ {
+ AmazonKinesis mockKinesis = EasyMock.mock(AmazonKinesis.class);
+ KinesisRecordSupplier target = new KinesisRecordSupplier(mockKinesis,
+ recordsPerFetch,
+ 0,
+ 2,
+ false,
+ 100,
+ 5000,
+ 5000,
+ 60000,
+ 5,
+ true
+ );
+ Record record = new Record();
+ String shardId;
+
+ // No records and null iterator -> empty
+ shardId = "0";
+ isClosedShardEmptyHelper(mockKinesis, shardId, new ArrayList<>(), null);
+ Assert.assertTrue(target.isClosedShardEmpty(STREAM, shardId));
+
+ // no records and non-null iterator -> non-empty
+ shardId = "1";
+ isClosedShardEmptyHelper(mockKinesis, shardId, new ArrayList<>(),
"nextIterator");
+ Assert.assertFalse(target.isClosedShardEmpty(STREAM, shardId));
+
+ // non-empty records and null iterator -> non-empty
+ shardId = "2";
+ isClosedShardEmptyHelper(mockKinesis, shardId,
Collections.singletonList(record), null);
+ Assert.assertFalse(target.isClosedShardEmpty(STREAM, shardId));
+
+ // non-empty records and non-null iterator -> non-empty
+ shardId = "3";
+ isClosedShardEmptyHelper(mockKinesis, shardId,
Collections.singletonList(record), "nextIterator");
+ Assert.assertFalse(target.isClosedShardEmpty(STREAM, shardId));
+ }
+
+ private void isClosedShardEmptyHelper(AmazonKinesis kinesis, String shardId,
Review comment:
done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]