dlmarion commented on code in PR #3180:
URL: https://github.com/apache/accumulo/pull/3180#discussion_r1097415535


##########
test/src/main/java/org/apache/accumulo/test/VolumeManagerIT.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Map;
+
+import org.apache.accumulo.core.client.Accumulo;
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.admin.NewTableConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.ConfigurableMacBase;
+import org.apache.accumulo.test.functional.ReadWriteIT;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.junit.jupiter.api.Test;
+
+public class VolumeManagerIT extends ConfigurableMacBase {
+
+  private String vol1;
+  private String vol2;
+
+  @Override
+  protected void configure(MiniAccumuloConfigImpl cfg, Configuration 
hadoopCoreSite) {
+    cfg.useMiniDFS(true);
+    cfg.setFinalSiteConfigUpdater((config) -> {
+      vol1 = config.getSiteConfig().get(Property.INSTANCE_VOLUMES.getKey());
+      assertTrue(vol1.contains("localhost"));
+      vol2 = vol1.replace("localhost", "127.0.0.1");
+      config.setProperty(Property.INSTANCE_VOLUMES.getKey(), String.join(",", 
vol2, vol1));
+
+      // Set Volume specific HDFS overrides
+      config.setProperty("general.volume.chooser",
+          "org.apache.accumulo.core.spi.fs.PreferredVolumeChooser");
+      config.setProperty("general.custom.volume.preferred.default", vol1);
+      config.setProperty("general.custom.volume.preferred.logger", vol2);
+
+      // Need to escape the colons in the custom property volume because it's 
part of the key. It's
+      // being
+      // written out to a file and read in using the Properties object.
+      String vol1FileOutput = vol1.replaceAll(":", "\\\\:");
+      String vol2FileOutput = vol2.replaceAll(":", "\\\\:");
+      config.setProperty(
+          Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + vol1FileOutput + 
".dfs.blocksize",
+          "10485760");
+      config.setProperty(
+          Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + vol2FileOutput + 
".dfs.blocksize",
+          "104857600");
+      config.setProperty(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + 
vol1FileOutput
+          + ".dfs.client.use.datanode.hostname", "true");
+      config.setProperty(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + 
vol2FileOutput
+          + ".dfs.client.use.datanode.hostname", "false");
+      config.setProperty(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + 
vol1FileOutput
+          + ".dfs.client.hedged.read.threadpool.size", "0");
+      config.setProperty(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + 
vol2FileOutput
+          + ".dfs.client.hedged.read.threadpool.size", "1");
+    });
+  }
+
+  @Test
+  public void testHdfsConfigOverrides() throws Exception {
+    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProperties()).build()) {
+
+      Map<String,String> siteConfig = 
c.instanceOperations().getSiteConfiguration();
+      assertEquals("10485760", siteConfig
+          .get(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + vol1 + 
".dfs.blocksize"));
+      assertEquals("104857600", siteConfig

Review Comment:
   Updated test to use proposed value in e0c12c4.



-- 
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]

Reply via email to