mirror of https://github.com/apache/druid.git
[pull-deps] If --clean flag is not set, skip creating root extension directories if they already exist. (#3130)
This commit is contained in:
parent
8b7d9750ee
commit
d2636d1a64
|
@ -461,6 +461,10 @@ public class PullDependencies implements Runnable
|
||||||
|
|
||||||
private void createRootExtensionsDirectory(File atLocation)
|
private void createRootExtensionsDirectory(File atLocation)
|
||||||
{
|
{
|
||||||
|
if (atLocation.isDirectory()) {
|
||||||
|
log.info("Root extension directory [%s] already exists, skip creating");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!atLocation.mkdirs()) {
|
if (!atLocation.mkdirs()) {
|
||||||
throw new ISE(
|
throw new ISE(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
|
@ -157,9 +157,9 @@ public class PullDependenciesTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If --clean is not specified and something already exists at druid.extensions.directory, ISE should be thrown
|
* If --clean is not specified and root extension directory already exists, skip creating.
|
||||||
*/
|
*/
|
||||||
@Test(expected = ISE.class)
|
@Test()
|
||||||
public void testPullDependencies_root_extension_dir_exists()
|
public void testPullDependencies_root_extension_dir_exists()
|
||||||
{
|
{
|
||||||
rootExtensionsDir.mkdir();
|
rootExtensionsDir.mkdir();
|
||||||
|
@ -167,16 +167,35 @@ public class PullDependenciesTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If --clean is not specified and something already exists at druid.extensions.hadoopDependenciesDir,
|
* A file exists on the root extension directory path, but it's not a directory, throw ISE.
|
||||||
* ISE should be thrown
|
|
||||||
*/
|
*/
|
||||||
@Test(expected = ISE.class)
|
@Test(expected = ISE.class)
|
||||||
|
public void testPullDependencies_root_extension_dir_bad_state() throws IOException
|
||||||
|
{
|
||||||
|
Assert.assertTrue(rootExtensionsDir.createNewFile());
|
||||||
|
pullDependencies.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If --clean is not specified and hadoop dependencies directory already exists, skip creating.
|
||||||
|
*/
|
||||||
|
@Test()
|
||||||
public void testPullDependencies_root_hadoop_dependencies_dir_exists()
|
public void testPullDependencies_root_hadoop_dependencies_dir_exists()
|
||||||
{
|
{
|
||||||
rootHadoopDependenciesDir.mkdir();
|
rootHadoopDependenciesDir.mkdir();
|
||||||
pullDependencies.run();
|
pullDependencies.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A file exists on the root hadoop dependencies directory path, but it's not a directory, throw ISE.
|
||||||
|
*/
|
||||||
|
@Test(expected = ISE.class)
|
||||||
|
public void testPullDependencies_root_hadoop_dependencies_dir_bad_state() throws IOException
|
||||||
|
{
|
||||||
|
Assert.assertTrue(rootHadoopDependenciesDir.createNewFile());
|
||||||
|
pullDependencies.run();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPullDependencies()
|
public void testPullDependencies()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue