From c4a1ff6cb612e3c6903c4bed345d2945de9ef913 Mon Sep 17 00:00:00 2001 From: Chunxue Yang Date: Tue, 22 Oct 2019 16:06:46 -0700 Subject: [PATCH] Adding comments for ShardEnd related unit tests --- .../kinesis/leases/HierarchicalShardSyncerTest.java | 11 +++++++++++ .../amazon/kinesis/lifecycle/ShutdownTaskTest.java | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/HierarchicalShardSyncerTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/HierarchicalShardSyncerTest.java index e9db752c..23d2e423 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/HierarchicalShardSyncerTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/HierarchicalShardSyncerTest.java @@ -171,6 +171,9 @@ public class HierarchicalShardSyncerTest { testCheckAndCreateLeasesForShardsIfMissing(INITIAL_POSITION_LATEST); } + /** + * Test checkAndCreateLeaseForNewShards while not providing a pre-fetched list of shards + */ @Test public void testCheckAndCreateLeasesForShardsIfMissingAtLatest() throws Exception { final List shards = constructShardListForGraphA(); @@ -205,6 +208,10 @@ public class HierarchicalShardSyncerTest { } + /** + * Test checkAndCreateLeaseForNewShards with a pre-fetched list of shards. In this scenario, shardDetector.listShards() + * should never be called. + */ @Test public void testCheckAndCreateLeasesForShardsWithShardList() throws Exception { final List latestShards = constructShardListForGraphA(); @@ -237,6 +244,10 @@ public class HierarchicalShardSyncerTest { verify(dynamoDBLeaseRefresher, never()).deleteLease(any(Lease.class)); } + /** + * Test checkAndCreateLeaseForNewShards with an empty list of shards. In this scenario, shardDetector.listShards() + * should never be called. + */ @Test public void testCheckAndCreateLeasesForShardsWithEmptyShardList() throws Exception { final List shards = constructShardListForGraphA(); diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShutdownTaskTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShutdownTaskTest.java index ea51a91c..6af62edb 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShutdownTaskTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShutdownTaskTest.java @@ -109,6 +109,7 @@ public class ShutdownTaskTest { /** * Test method for {@link ShutdownTask#call()}. + * This test is for the scenario that customer doesn't implement checkpoint in their implementation */ @Test public final void testCallWhenApplicationDoesNotCheckpoint() { @@ -122,6 +123,7 @@ public class ShutdownTaskTest { /** * Test method for {@link ShutdownTask#call()}. + * This test is for the scenario that checkAndCreateLeaseForNewShards throws an exception. */ @Test public final void testCallWhenSyncingShardsThrows() throws Exception { @@ -147,6 +149,7 @@ public class ShutdownTaskTest { /** * Test method for {@link ShutdownTask#call()}. + * This test is for the scenario that ShutdownTask is created for ShardConsumer reaching the Shard End. */ @Test public final void testCallWhenTrueShardEnd() { @@ -171,6 +174,7 @@ public class ShutdownTaskTest { /** * Test method for {@link ShutdownTask#call()}. + * This test is for the scenario that a ShutdownTask is created for detecting a false Shard End. */ @Test public final void testCallWhenFalseShardEnd() { @@ -194,6 +198,7 @@ public class ShutdownTaskTest { /** * Test method for {@link ShutdownTask#call()}. + * This test is for the scenario that a ShutdownTask is created for the ShardConsumer losing the lease. */ @Test public final void testCallWhenLeaseLost() {