-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10284. Move GenericTestUtils#getTempPath to MiniOzoneCluster #8300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 14 commits
046d6a8
05cf7c0
944571b
e8e4a1e
0740425
a3bdd8c
a630951
d2ab079
859b67d
269928e
cf949bf
9944fb1
1336686
8488bfd
b06a0ef
7e358d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,14 +35,16 @@ | |
| import org.apache.hadoop.ozone.om.OzoneManager; | ||
| import org.apache.hadoop.ozone.recon.ReconServer; | ||
| import org.apache.hadoop.security.authentication.client.AuthenticationException; | ||
| import org.apache.ozone.test.GenericTestUtils; | ||
| import org.apache.ratis.util.ExitUtils; | ||
| import org.apache.ratis.util.function.CheckedFunction; | ||
|
|
||
| /** | ||
| * Interface used for MiniOzoneClusters. | ||
| */ | ||
| public interface MiniOzoneCluster extends AutoCloseable { | ||
| String SYSPROP_TEST_DATA_DIR = "test.build.data"; | ||
| String DEFAULT_TEST_DATA_PATH = "target/test/data/"; | ||
| boolean WINDOWS = System.getProperty("os.name").startsWith("Windows"); | ||
|
|
||
| /** | ||
| * Returns the Builder to construct MiniOzoneCluster. | ||
|
|
@@ -250,7 +252,29 @@ default String getName() { | |
| } | ||
|
|
||
| default String getBaseDir() { | ||
| return GenericTestUtils.getTempPath(getName()); | ||
| return getTempPath(getName()); | ||
| } | ||
|
|
||
| /** | ||
| * Get a temp path. This may or may not be relative; it depends on what the | ||
| * {@link #SYSPROP_TEST_DATA_DIR} is set to. If unset, it returns a path | ||
| * under the relative path {@link #DEFAULT_TEST_DATA_PATH} | ||
| * | ||
| * @param subpath sub path, with no leading "/" character | ||
| * @return a string to use in paths | ||
| */ | ||
| static String getTempPath(String subpath) { | ||
| String prop = WINDOWS ? DEFAULT_TEST_DATA_PATH | ||
| : System.getProperty(SYSPROP_TEST_DATA_DIR, DEFAULT_TEST_DATA_PATH); | ||
|
|
||
| if (prop.isEmpty()) { | ||
| // corner case: property is there but empty | ||
| prop = DEFAULT_TEST_DATA_PATH; | ||
| } | ||
| if (!prop.endsWith("/")) { | ||
| prop = prop + "/"; | ||
| } | ||
| return prop + subpath; | ||
| } | ||
|
||
|
|
||
| /** | ||
|
|
@@ -303,7 +327,7 @@ public Builder setSCMConfigurator(SCMConfigurator configurator) { | |
|
|
||
| private void setClusterId() { | ||
| clusterId = UUID.randomUUID().toString(); | ||
| path = GenericTestUtils.getTempPath( | ||
| path = getTempPath( | ||
| MiniOzoneClusterImpl.class.getSimpleName() + "-" + clusterId); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems
DEFAULT_TEST_DATA_DIRcan be removed as well, it's not used anymore