|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
package org.elasticsearch;
|
|
|
|
|
|
+import org.elasticsearch.common.Booleans;
|
|
|
import org.elasticsearch.common.io.FileSystemUtils;
|
|
|
import org.elasticsearch.common.io.stream.StreamInput;
|
|
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
@@ -59,7 +60,18 @@ public class Build {
|
|
|
// not running from the official elasticsearch jar file (unit tests, IDE, uber client jar, shadiness)
|
|
|
shortHash = "Unknown";
|
|
|
date = "Unknown";
|
|
|
- isSnapshot = true;
|
|
|
+ final String buildSnapshot = System.getProperty("build.snapshot");
|
|
|
+ if (buildSnapshot != null) {
|
|
|
+ try {
|
|
|
+ Class.forName("com.carrotsearch.randomizedtesting.RandomizedContext");
|
|
|
+ } catch (final ClassNotFoundException e) {
|
|
|
+ // we are not in tests but build.snapshot is set, bail hard
|
|
|
+ throw new IllegalStateException("build.snapshot set to [" + buildSnapshot + "] but not running tests");
|
|
|
+ }
|
|
|
+ isSnapshot = Booleans.parseBoolean(buildSnapshot);
|
|
|
+ } else {
|
|
|
+ isSnapshot = true;
|
|
|
+ }
|
|
|
}
|
|
|
if (shortHash == null) {
|
|
|
throw new IllegalStateException("Error finding the build shortHash. " +
|