DomGarguilo commented on code in PR #3228: URL: https://github.com/apache/accumulo/pull/3228#discussion_r1274107884
########## test/src/main/java/org/apache/accumulo/test/ExportTableCommandWithMultipleVolumesIT.java: ########## @@ -0,0 +1,156 @@ +/* + * 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.assertTrue; + +import java.io.File; +import java.time.Duration; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.apache.accumulo.core.client.Accumulo; +import org.apache.accumulo.core.client.AccumuloClient; +import org.apache.accumulo.core.client.BatchWriter; +import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.metadata.schema.MetadataSchema; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.harness.AccumuloClusterHarness; +import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.RawLocalFileSystem; +import org.apache.hadoop.io.Text; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExportTableCommandWithMultipleVolumesIT extends AccumuloClusterHarness { + private static final Logger log = + LoggerFactory.getLogger(ExportTableCommandWithMultipleVolumesIT.class); + + Path v1, v2; + + public static String[] row_numbers = "1,2,3,4,5,6,7,8,9,10".split(","); + + String baseDirStr = ""; + String baseDir2Str = ""; + String originalVolume = ""; + String secondVolume = ""; + + @Override + protected Duration defaultTimeout() { + return Duration.ofMinutes(1); + } + + @Override + public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { + File baseDir = cfg.getDir(); + + // get first volume name + baseDirStr = baseDir.toString(); + String[] baseDirArray = baseDirStr.split("/"); + originalVolume = baseDirArray[2]; + + // get second volume name + String[] baseDir2Array = baseDirArray; + baseDir2Array[2] = baseDir2Array[2] + "2"; Review Comment: The test fails for me since it is trying to use a directory that does not exist: `dgarguilo2` is not a user and is not a directory. I suggest looking into using a `@TempDir` like we do with other tests so a directory is sure to be created and cleaned up for this test. <details> ``` 2023-07-25T16:42:33,408 [init.Initialize] DEBUG: creating instance directories for base: file:/home/dgarguilo/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v1 2023-07-25T16:42:33,427 [init.Initialize] INFO : Directory file:/home/dgarguilo/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v1/version/11 created - call returned true 2023-07-25T16:42:33,430 [init.Initialize] INFO : Directory file:/home/dgarguilo/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v1/instance_id created - call returned true 2023-07-25T16:42:33,457 [init.Initialize] INFO : Created instanceId file file:/home/dgarguilo/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v1/instance_id/7f6b05aa-4141-4781-ab1b-6a7f7667fae4 in hdfs 2023-07-25T16:42:33,457 [init.Initialize] DEBUG: creating instance directories for base: file:/home/dgarguilo2/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v2 2023-07-25T16:42:33,462 [init.Initialize] INFO : Directory file:/home/dgarguilo2/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v2/version/11 created - call returned false 2023-07-25T16:42:33,463 [init.Initialize] INFO : Directory file:/home/dgarguilo2/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v2/instance_id created - call returned false 2023-07-25T16:42:33,465 [init.Initialize] ERROR: Problem creating new directories java.io.IOException: Mkdirs failed to create file:/home/dgarguilo2/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v2/instance_id at org.apache.hadoop.fs.RawLocalFileSystem.create(RawLocalFileSystem.java:561) ~[hadoop-client-api-3.3.5.jar:?] at org.apache.hadoop.fs.RawLocalFileSystem.create(RawLocalFileSystem.java:549) ~[hadoop-client-api-3.3.5.jar:?] at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1210) ~[hadoop-client-api-3.3.5.jar:?] at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1165) ~[hadoop-client-api-3.3.5.jar:?] at org.apache.hadoop.fs.FileSystem.createNewFile(FileSystem.java:1499) ~[hadoop-client-api-3.3.5.jar:?] at org.apache.accumulo.server.fs.VolumeManagerImpl.createNewFile(VolumeManagerImpl.java:177) ~[classes/:?] at org.apache.accumulo.server.init.Initialize.createDirs(Initialize.java:291) ~[classes/:?] at org.apache.accumulo.server.init.Initialize.doInit(Initialize.java:175) ~[classes/:?] at org.apache.accumulo.server.init.Initialize.execute(Initialize.java:543) ~[classes/:?] at org.apache.accumulo.server.init.Initialize.main(Initialize.java:583) ~[classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.apache.accumulo.start.Main.lambda$execMainClass$1(Main.java:118) ~[classes/:?] at java.lang.Thread.run(Thread.java:829) [?:?] 2023-07-25T16:42:33,473 [init.Initialize] ERROR: FATAL: Problem during initialize java.io.IOException: Problem creating directories on [file:/home/dgarguilo2/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v2, file:/home/dgarguilo/github/accumulo/test/target/mini-tests/org.apache.accumulo.test.ExportTableCommandWithMultipleVolumesIT_testExportCommand/volumes/v1] at org.apache.accumulo.server.init.Initialize.doInit(Initialize.java:176) ~[classes/:?] at org.apache.accumulo.server.init.Initialize.execute(Initialize.java:543) ~[classes/:?] at org.apache.accumulo.server.init.Initialize.main(Initialize.java:583) ~[classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.apache.accumulo.start.Main.lambda$execMainClass$1(Main.java:118) ~[classes/:?] at java.lang.Thread.run(Thread.java:829) [?:?] ``` </details> -- 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]
