maedhroz commented on code in PR #2660:
URL: https://github.com/apache/cassandra/pull/2660#discussion_r1319361735
##########
test/unit/org/apache/cassandra/config/YamlConfigurationLoaderTest.java:
##########
@@ -49,6 +50,96 @@
public class YamlConfigurationLoaderTest
{
+ @Test
+ public void repairRetryEmpty()
+ {
+ RepairRetrySpec repair_retries = loadRepairRetry(ImmutableMap.of());
+ // repair is empty
+ assertThat(repair_retries.isEnabled()).isFalse();
+ for (RepairRetrySpec.Verb v : RepairRetrySpec.Verb.values())
+ assertThat(repair_retries.get(v).isEnabled()).isFalse();
+ }
+
+ @Test
+ public void repairRetryInheritance()
+ {
+ RepairRetrySpec repair_retries =
loadRepairRetry(ImmutableMap.of("type", "Expoential",
+
"max_attempts", "3"));
+ assertThat(repair_retries.isEnabled()).isTrue();
+ assertThat(repair_retries.getMaxAttempts()).isEqualTo(3);
+ for (RepairRetrySpec.Verb v : RepairRetrySpec.Verb.values())
+ {
+ RetrySpec spec = repair_retries.get(v);
+ assertThat(spec.isEnabled()).isTrue();
+ assertThat(spec.getMaxAttempts()).isEqualTo(3);
+ }
+ }
+
+ @Test
+ public void repairRetryOverride()
+ {
+ RepairRetrySpec repair_retries =
loadRepairRetry(ImmutableMap.of("verbs", ImmutableMap.of(
+ "VALIDATION_RSP", ImmutableMap.of("max_attempts", 10,
+ "base_sleep_time", "1s",
+ "max_sleep_time", "10s")
+ )));
+ assertThat(repair_retries.isEnabled()).isFalse();
+ assertThat(repair_retries.getMaxAttempts()).isNull();
+ assertThat(repair_retries.baseSleepTime).isEqualTo(new
DurationSpec.LongNanosecondsBound("200ms"));
+ assertThat(repair_retries.maxSleepTime).isEqualTo(new
DurationSpec.LongNanosecondsBound("1s"));
+
+ RetrySpec spec =
repair_retries.get(RepairRetrySpec.Verb.VALIDATION_RSP);
+ assertThat(spec.isEnabled()).isTrue();
+ assertThat(spec.maxAttempts).isEqualTo(10);
+ assertThat(spec.baseSleepTime).isEqualTo(new
DurationSpec.LongNanosecondsBound("1s"));
+ assertThat(spec.maxSleepTime).isEqualTo(new
DurationSpec.LongNanosecondsBound("10s"));
+ }
+
+ @Test
+ public void repairRetryDisabled()
+ {
+ Map<RepairRetrySpec.Verb, Object> verbs = new
EnumMap<>(RepairRetrySpec.Verb.class);
+ for (RepairRetrySpec.Verb v : RepairRetrySpec.Verb.values())
+ verbs.put(v, ImmutableMap.of("max_attempts", 10));
+ RepairRetrySpec repair_retries =
loadRepairRetry(ImmutableMap.of("verbs", verbs,
+
"max_attempts", 10));
+ assertThat(repair_retries.isEnabled()).isTrue();
+ assertThat(repair_retries.getMaxAttempts()).isEqualTo(10);
+ assertThat(repair_retries.getBaseSleepTime()).isEqualTo(new
DurationSpec.LongNanosecondsBound("200ms"));
Review Comment:
nit: Maybe make public and use `DEFAULT_BASE_SLEEP` here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]