@@ -190,6 +190,18 @@ void configuringRateAndRetryViaAnnotationsShouldWork() {
190
190
assertEquals (Duration .ofSeconds (3 ), rateLimiter .getRefreshPeriod ());
191
191
}
192
192
193
+ @ Test
194
+ void configuringRateLimitAndGradualRetryViaSuperClassShouldWork () {
195
+ var config = configFor (new GradualRetryAndRateLimitedOnSuperClass ());
196
+ final var retry = config .getRetry ();
197
+ final var testRetry = assertInstanceOf (GenericRetry .class , retry );
198
+ assertEquals (BaseClassWithGradualRetryAndRateLimited .RETRY_MAX_ATTEMPTS , testRetry .getMaxAttempts ());
199
+
200
+ final var rateLimiter = assertInstanceOf (LinearRateLimiter .class , config .getRateLimiter ());
201
+ assertEquals (BaseClassWithGradualRetryAndRateLimited .RATE_LIMITED_MAX_RECONCILIATIONS , rateLimiter .getLimitForPeriod ());
202
+ assertEquals (Duration .ofSeconds (BaseClassWithGradualRetryAndRateLimited .RATE_LIMITED_WITHIN_SECONDS ), rateLimiter .getRefreshPeriod ());
203
+ }
204
+
193
205
@ Test
194
206
void checkingRetryingGraduallyWorks () {
195
207
var config = configFor (new CheckRetryingGraduallyConfiguration ());
@@ -382,6 +394,27 @@ public UpdateControl<ConfigMap> reconcile(ConfigMap resource, Context<ConfigMap>
382
394
}
383
395
}
384
396
397
+ @ ControllerConfiguration
398
+ private static class GradualRetryAndRateLimitedOnSuperClass extends BaseClassWithGradualRetryAndRateLimited implements Reconciler <ConfigMap > {
399
+
400
+ @ Override
401
+ public UpdateControl <ConfigMap > reconcile (ConfigMap resource , Context <ConfigMap > context ) throws Exception {
402
+ return null ;
403
+ }
404
+ }
405
+
406
+ @ RateLimited (
407
+ maxReconciliations = BaseClassWithGradualRetryAndRateLimited .RATE_LIMITED_MAX_RECONCILIATIONS ,
408
+ within = BaseClassWithGradualRetryAndRateLimited .RATE_LIMITED_WITHIN_SECONDS
409
+ )
410
+ @ GradualRetry (maxAttempts = BaseClassWithGradualRetryAndRateLimited .RETRY_MAX_ATTEMPTS )
411
+ private static class BaseClassWithGradualRetryAndRateLimited {
412
+
413
+ public static final int RATE_LIMITED_MAX_RECONCILIATIONS = 7 ;
414
+ public static final int RATE_LIMITED_WITHIN_SECONDS = 3 ;
415
+ public static final int RETRY_MAX_ATTEMPTS = 3 ;
416
+ }
417
+
385
418
private static class ControllerConfigurationOnSuperClass extends BaseClass {
386
419
}
387
420
0 commit comments