Skip to content

Commit

Permalink
Create temporary directory if needed in CCR test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jasontedor committed Sep 9, 2018
1 parent 3f8908d commit 7e32f7a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {",
Expand Down

0 comments on commit 7e32f7a

Please sign in to comment.