smengcl commented on code in PR #8502:
URL: https://github.com/apache/ozone/pull/8502#discussion_r2124350737
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java:
##########
@@ -451,4 +452,47 @@ private String getOMAddrKeyWithSuffix(String serviceId,
String nodeId) {
return ConfUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY,
serviceId, nodeId);
}
+
+ @Test
+ public void testMetadataDBMountPointsSame() throws Exception {
+ // Backup original config values
+ final String ratisDir = conf.get(OMConfigKeys.OZONE_OM_RATIS_SNAPSHOT_DIR);
+ final String metadataDirs = conf.get(HddsConfigKeys.OZONE_METADATA_DIRS);
+ final String omDbDirs = conf.get(OMConfigKeys.OZONE_OM_DB_DIRS);
+
+ // Under the same mount
+ conf.unset(OMConfigKeys.OZONE_OM_RATIS_SNAPSHOT_DIR);
+ conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
Files.createTempDirectory("tempdir1-").toString());
+ conf.set(OMConfigKeys.OZONE_OM_DB_DIRS,
Files.createTempDirectory("tempdir2-").toString());
+
+ // Expect OM to start successfully
+ startCluster();
+
+ // Restore config values
+ conf.set(OMConfigKeys.OZONE_OM_RATIS_SNAPSHOT_DIR, ratisDir);
+ conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metadataDirs);
+ conf.set(OMConfigKeys.OZONE_OM_DB_DIRS, omDbDirs);
+ }
+
+ @Test
+ public void testMetadataDBMountPointsDifferent() throws Exception {
+ // Backup original config values
+ final String ratisDir = conf.get(OMConfigKeys.OZONE_OM_RATIS_SNAPSHOT_DIR);
+ final String metadataDirs = conf.get(HddsConfigKeys.OZONE_METADATA_DIRS);
+ final String omDbDirs = conf.get(OMConfigKeys.OZONE_OM_DB_DIRS);
+
+ // Under the same mount
+ conf.unset(OMConfigKeys.OZONE_OM_RATIS_SNAPSHOT_DIR);
+ conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, "/opt/test-metadata-dir");
Review Comment:
Yeah it is not easy to test this without mocks in some way..
--
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]