Skip to content

Commit

Permalink
Remove unrequired path relativizer for licence repro info
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Dec 11, 2020
1 parent f727431 commit 3b95a41
Showing 1 changed file with 1 addition and 23 deletions.
Expand Up @@ -25,7 +25,6 @@
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
Expand All @@ -34,7 +33,6 @@
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;

import java.nio.file.Path;
import java.util.Locale;
import java.util.TimeZone;

Expand Down Expand Up @@ -183,31 +181,11 @@ private ReproduceErrorMessageBuilder appendESProperties() {
appendOpt("tests.distribution", System.getProperty("tests.distribution"));
appendOpt("runtime.java", Integer.toString(JavaVersion.current().getVersion().get(0)));
appendOpt("runtime.java", Integer.toString(JavaVersion.current().getVersion().get(0)));
appendOpt("license.key", relativePath(System.getProperty("licence.key")));
appendOpt("license.key", System.getProperty("licence.key"));
appendOpt(ESTestCase.FIPS_SYSPROP, System.getProperty(ESTestCase.FIPS_SYSPROP));
return this;
}

private String relativePath(String pathProperty) {
if(pathProperty == null) {
return null;
}
Path path = PathUtils.get(pathProperty);
if(path.isAbsolute()) {
// try to resolve workspace root from Jenksin WORKSPACE env variable
String workspace = System.getenv("WORKSPACE");
if(workspace == null) {
// fallback to resolve workspace root from teamcity checkout dir
workspace = System.getProperty("teamcity.build.workingDir");
}
if(workspace != null) {
// resolve path relative to workspace root
return PathUtils.get(workspace).relativize(path).toString();
}
}
return pathProperty;
}

public ReproduceErrorMessageBuilder appendClientYamlSuiteProperties() {
return appendProperties(REST_TESTS_SUITE, REST_TESTS_BLACKLIST);
}
Expand Down

0 comments on commit 3b95a41

Please sign in to comment.