Bug fix in lease refresher integration test with occasional failures (#1159)

This commit is contained in:
Meher M 2023-06-29 21:51:07 -07:00 committed by GitHub
parent 290facdd51
commit 42eb753d62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@ package software.amazon.kinesis.leases.dynamodb;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
@ -34,7 +35,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.eq; import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -299,17 +299,12 @@ public class DynamoDBLeaseRefresherIntegrationTest extends LeaseIntegrationTest
@Test @Test
public void testWaitUntilLeaseTableExists() throws LeasingException { public void testWaitUntilLeaseTableExists() throws LeasingException {
DynamoDBLeaseRefresher refresher = new DynamoDBLeaseRefresher("nagl_ShardProgress", ddbClient, final UUID uniqueId = UUID.randomUUID();
new DynamoDBLeaseSerializer(), true, tableCreatorCallback) { DynamoDBLeaseRefresher refresher = new DynamoDBLeaseRefresher("tableEventuallyExists_" + uniqueId, ddbClient,
@Override new DynamoDBLeaseSerializer(), true, tableCreatorCallback);
long sleep(long timeToSleepMillis) {
fail("Should not sleep");
return 0L;
}
}; refresher.createLeaseTableIfNotExists();
assertTrue(refresher.waitUntilLeaseTableExists(1, 20));
assertTrue(refresher.waitUntilLeaseTableExists(1, 1));
} }
@Test @Test