Adding comments for ShardEnd related unit tests

This commit is contained in:
Chunxue Yang 2019-10-22 16:06:46 -07:00
parent 2db1f068f7
commit c4a1ff6cb6
2 changed files with 16 additions and 0 deletions

View file

@ -171,6 +171,9 @@ public class HierarchicalShardSyncerTest {
testCheckAndCreateLeasesForShardsIfMissing(INITIAL_POSITION_LATEST); testCheckAndCreateLeasesForShardsIfMissing(INITIAL_POSITION_LATEST);
} }
/**
* Test checkAndCreateLeaseForNewShards while not providing a pre-fetched list of shards
*/
@Test @Test
public void testCheckAndCreateLeasesForShardsIfMissingAtLatest() throws Exception { public void testCheckAndCreateLeasesForShardsIfMissingAtLatest() throws Exception {
final List<Shard> shards = constructShardListForGraphA(); final List<Shard> 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 @Test
public void testCheckAndCreateLeasesForShardsWithShardList() throws Exception { public void testCheckAndCreateLeasesForShardsWithShardList() throws Exception {
final List<Shard> latestShards = constructShardListForGraphA(); final List<Shard> latestShards = constructShardListForGraphA();
@ -237,6 +244,10 @@ public class HierarchicalShardSyncerTest {
verify(dynamoDBLeaseRefresher, never()).deleteLease(any(Lease.class)); 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 @Test
public void testCheckAndCreateLeasesForShardsWithEmptyShardList() throws Exception { public void testCheckAndCreateLeasesForShardsWithEmptyShardList() throws Exception {
final List<Shard> shards = constructShardListForGraphA(); final List<Shard> shards = constructShardListForGraphA();

View file

@ -109,6 +109,7 @@ public class ShutdownTaskTest {
/** /**
* Test method for {@link ShutdownTask#call()}. * Test method for {@link ShutdownTask#call()}.
* This test is for the scenario that customer doesn't implement checkpoint in their implementation
*/ */
@Test @Test
public final void testCallWhenApplicationDoesNotCheckpoint() { public final void testCallWhenApplicationDoesNotCheckpoint() {
@ -122,6 +123,7 @@ public class ShutdownTaskTest {
/** /**
* Test method for {@link ShutdownTask#call()}. * Test method for {@link ShutdownTask#call()}.
* This test is for the scenario that checkAndCreateLeaseForNewShards throws an exception.
*/ */
@Test @Test
public final void testCallWhenSyncingShardsThrows() throws Exception { public final void testCallWhenSyncingShardsThrows() throws Exception {
@ -147,6 +149,7 @@ public class ShutdownTaskTest {
/** /**
* Test method for {@link ShutdownTask#call()}. * Test method for {@link ShutdownTask#call()}.
* This test is for the scenario that ShutdownTask is created for ShardConsumer reaching the Shard End.
*/ */
@Test @Test
public final void testCallWhenTrueShardEnd() { public final void testCallWhenTrueShardEnd() {
@ -171,6 +174,7 @@ public class ShutdownTaskTest {
/** /**
* Test method for {@link ShutdownTask#call()}. * Test method for {@link ShutdownTask#call()}.
* This test is for the scenario that a ShutdownTask is created for detecting a false Shard End.
*/ */
@Test @Test
public final void testCallWhenFalseShardEnd() { public final void testCallWhenFalseShardEnd() {
@ -194,6 +198,7 @@ public class ShutdownTaskTest {
/** /**
* Test method for {@link ShutdownTask#call()}. * Test method for {@link ShutdownTask#call()}.
* This test is for the scenario that a ShutdownTask is created for the ShardConsumer losing the lease.
*/ */
@Test @Test
public final void testCallWhenLeaseLost() { public final void testCallWhenLeaseLost() {