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.
This commit is contained in:
Jason Tedor 2018-09-09 07:16:56 -04:00
parent 5a38c930fc
commit c67b0ba33e
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,11 @@ leaderClusterTestRunner {
task writeJavaPolicy { task writeJavaPolicy {
doLast { 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( javaPolicy.write(
[ [
"grant {", "grant {",