Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@
import org.elasticsearch.packaging.util.Platforms;
import org.junit.Before;

import java.nio.file.Files;
import java.util.List;

import static java.nio.file.StandardOpenOption.APPEND;
import static java.nio.file.StandardOpenOption.CREATE;
import static org.elasticsearch.packaging.util.FileUtils.append;
import static org.elasticsearch.packaging.util.ServerUtils.makeRequest;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assume.assumeFalse;

Expand All @@ -40,6 +46,19 @@ public void test10Install() throws Exception {
install();
}

public void test50StrictDuplicateDetectionDeprecationWarning() throws Exception {
withCustomConfig(tempConf -> {
final List<String> jvmOptions = org.elasticsearch.common.collect.List.of("-Des.xcontent.strict_duplicate_detection=false");
Files.write(tempConf.resolve("jvm.options"), jvmOptions, CREATE, APPEND);
startElasticsearch();
stopElasticsearch();
});
assertThat(
FileUtils.slurp(installation.logs.resolve("elasticsearch_deprecation.log")),
containsString("The Java option es.xcontent.strict_duplicate_detection is set")
);
}

public void test60HostnameSubstitution() throws Exception {
String hostnameKey = Platforms.WINDOWS ? "COMPUTERNAME" : "HOSTNAME";
sh.getEnv().put(hostnameKey, "mytesthost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ static void init(
System.getProperty("java.home"));
DeprecationLogger.getLogger(Bootstrap.class).deprecate("java_version_11_required", message);
}
if (BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection") != null) {
final String message = String.format(
Locale.ROOT,
"The Java option es.xcontent.strict_duplicate_detection is set to [%s]; " +
"this option is deprecated and non-functional and should be removed from Java configuration.",
BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection"));
DeprecationLogger.getLogger(Bootstrap.class).deprecate("strict_duplicate_detection_setting_removed", message);
}
if (environment.pidFile() != null) {
try {
PidFile.create(environment.pidFile(), true);
Expand Down