Fix flaky HashRangesAreAlwaysComplete test (#1066)

Updates depth value for Merge and Reshard with some In-Progress Parents tests to prevent invalid hierarchy trees.
This commit is contained in:
furq-aws 2023-03-22 09:33:28 -07:00 committed by GitHub
parent b894669bda
commit 0627ba50bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,6 +58,8 @@ import static software.amazon.kinesis.leases.LeaseManagementConfig.DEFAULT_CONSE
public class PeriodicShardSyncManagerTest { public class PeriodicShardSyncManagerTest {
private static final int MAX_DEPTH_WITH_IN_PROGRESS_PARENTS = 1;
private StreamIdentifier streamIdentifier; private StreamIdentifier streamIdentifier;
private PeriodicShardSyncManager periodicShardSyncManager; private PeriodicShardSyncManager periodicShardSyncManager;
@Mock @Mock
@ -446,7 +448,7 @@ public class PeriodicShardSyncManagerTest {
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
int maxInitialLeaseCount = 100; int maxInitialLeaseCount = 100;
List<Lease> leases = generateInitialLeases(maxInitialLeaseCount); List<Lease> leases = generateInitialLeases(maxInitialLeaseCount);
reshard(leases, 5, ReshardType.MERGE, maxInitialLeaseCount, true); reshard(leases, MAX_DEPTH_WITH_IN_PROGRESS_PARENTS, ReshardType.MERGE, maxInitialLeaseCount, true);
Collections.shuffle(leases); Collections.shuffle(leases);
Assert.assertFalse(periodicShardSyncManager.hasHoleInLeases(streamIdentifier, leases).isPresent()); Assert.assertFalse(periodicShardSyncManager.hasHoleInLeases(streamIdentifier, leases).isPresent());
} }
@ -457,7 +459,7 @@ public class PeriodicShardSyncManagerTest {
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
int maxInitialLeaseCount = 100; int maxInitialLeaseCount = 100;
List<Lease> leases = generateInitialLeases(maxInitialLeaseCount); List<Lease> leases = generateInitialLeases(maxInitialLeaseCount);
reshard(leases, 5, ReshardType.ANY, maxInitialLeaseCount, true); reshard(leases, MAX_DEPTH_WITH_IN_PROGRESS_PARENTS, ReshardType.ANY, maxInitialLeaseCount, true);
Collections.shuffle(leases); Collections.shuffle(leases);
Assert.assertFalse(periodicShardSyncManager.hasHoleInLeases(streamIdentifier, leases).isPresent()); Assert.assertFalse(periodicShardSyncManager.hasHoleInLeases(streamIdentifier, leases).isPresent());
} }