Skip to content

Commit 6712857

Browse files
authored
Add backoff with jitter to Kinesis stabiltiy test (#6068)
* Add backoff with jitter to Kinesis stabiltiy test * Cleanup * re-add comment --------- Co-authored-by: Ran Vaknin <[email protected]>
1 parent 00be605 commit 6712857

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/stability-tests/src/it/java/software/amazon/awssdk/stability/tests/kinesis/KinesisStabilityTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ public void tearDown() {
116116
}
117117

118118
@RetryableTest(maxRetries = 3, retryableException = StabilityTestsRetryableException.class)
119-
public void putRecords_subscribeToShard() {
119+
public void putRecords_subscribeToShard() throws InterruptedException {
120120
putRecords();
121121
subscribeToShard();
122122
}
123123

124124
/**
125125
* We only have one run of subscribeToShard tests because it takes 5 minutes.
126126
*/
127-
private void subscribeToShard() {
127+
private void subscribeToShard() throws InterruptedException {
128128
log.info(() -> "starting to test subscribeToShard to stream: " + streamName);
129129
List<CompletableFuture<?>> completableFutures = generateSubscribeToShardFutures();
130130
StabilityTestRunner.newRunner()
@@ -170,12 +170,15 @@ private void putRecords() {
170170
* Generate request per consumer/shard combination
171171
* @return a lit of completablefutures
172172
*/
173-
private List<CompletableFuture<?>> generateSubscribeToShardFutures() {
173+
private List<CompletableFuture<?>> generateSubscribeToShardFutures() throws InterruptedException {
174174
List<CompletableFuture<?>> completableFutures = new ArrayList<>();
175+
int baseDelay = 150;
176+
int jitterRange = 150;
175177
for (int i = 0; i < CONSUMER_COUNT; i++) {
176178
final int consumerIndex = i;
177179
for (int j = 0; j < SHARD_COUNT; j++) {
178180
final int shardIndex = j;
181+
Thread.sleep(baseDelay + (int)(Math.random() * jitterRange));
179182
TestSubscribeToShardResponseHandler responseHandler =
180183
new TestSubscribeToShardResponseHandler(consumerIndex, shardIndex);
181184
CompletableFuture<Void> completableFuture =

0 commit comments

Comments
 (0)