From 7e32f7ada46dfe0f4116a73fcd5503ee47dde1da Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sun, 9 Sep 2018 07:16:56 -0400 Subject: [PATCH] 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. --- .../multi-cluster-with-non-compliant-license/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/ccr/qa/multi-cluster-with-non-compliant-license/build.gradle b/x-pack/plugin/ccr/qa/multi-cluster-with-non-compliant-license/build.gradle index c599903ced12e..845c9df533dba 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster-with-non-compliant-license/build.gradle +++ b/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 {",