ChenSammi commented on code in PR #11721:
URL: https://github.com/apache/ozone/pull/11721#discussion_r4374959834
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/reconfig/TestOmReconfiguration.java:
##########
@@ -260,4 +267,36 @@ void sstFilteringServiceInterval() throws
ReconfigurationException {
"SstFilteringService should not be null when enabled");
}
+ @Test
+ void keyLifecycleService() throws ReconfigurationException {
+ final OzoneManager om = cluster().getOzoneManager();
+ final KeyLifecycleService service =
om.getKeyManager().getKeyLifecycleService();
+ final boolean originalEnabled = service.status().getIsEnabled();
+ final String originalInterval =
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL);
+ final String originalWorkers =
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS);
+
+ getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
String.valueOf(!originalEnabled));
+ assertEquals(!originalEnabled, service.status().getIsEnabled());
+ assertEquals(!originalEnabled,
om.getLifecycleServiceStatus().getIsEnabled());
+
+ getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
"30s");
+ assertEquals(30000, service.getIntervalMillis());
+ assertEquals("30s",
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL));
+
+ getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS, "3");
+ assertEquals(3, service.getExecutorService().getCorePoolSize());
+
+ // Invalid values are rejected and the configuration is left unchanged
+ assertThrows(ReconfigurationException.class,
+ () ->
getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE,
"0"));
+ assertThrows(ReconfigurationException.class,
+ () ->
getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL, "-1"));
+ assertEquals(30000, service.getIntervalMillis());
+
+ getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
String.valueOf(originalEnabled));
+ getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
originalInterval);
+ getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
originalWorkers);
+ assertEquals(originalEnabled, service.status().getIsEnabled());
Review Comment:
Could you also add test for unset case?
--
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]