Browse Source

Create temporary directory if needed in CCR test

In the multi-cluster-with-non-compliant-license tests, we try to write
out a java.policy to a temporary directory. However, if this temporary
directory does not already exist then writing the java.policy file will
fail. This commit ensures that the temporary directory exists before we
attempt to write the java.policy file.
Jason Tedor 7 years ago
parent
commit
c67b0ba33e

+ 5 - 1
x-pack/plugin/ccr/qa/multi-cluster-with-non-compliant-license/build.gradle

@@ -22,7 +22,11 @@ leaderClusterTestRunner {
 
 task writeJavaPolicy {
     doLast {
-        final File javaPolicy = file("${buildDir}/tmp/java.policy")
+        final File tmp = file("${buildDir}/tmp")
+        if (tmp.exists() == false && tmp.mkdirs() == false) {
+            throw new GradleException("failed to create temporary directory [${tmp}]")
+        }
+        final File javaPolicy = file("${tmp}/java.policy")
         javaPolicy.write(
                 [
                         "grant {",