Защита стенда и управление секретами через OpenBao
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.example.mtusi_messenger.queue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class RetryPolicyTest {
|
||||
@Test
|
||||
void appliesExponentialBackoffWithBoundedJitter() {
|
||||
RetryPolicy policy = new RetryPolicy(Duration.ofSeconds(1), Duration.ofSeconds(30));
|
||||
|
||||
for (int attempt = 2; attempt <= 8; attempt++) {
|
||||
long ceiling = Math.min(30_000L, 1_000L << (attempt - 2));
|
||||
long delay = policy.delayForAttempt(attempt).toMillis();
|
||||
assertTrue(delay >= Math.max(1, ceiling / 2));
|
||||
assertTrue(delay <= ceiling);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user