mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-29 03:18:26 +00:00
Bundle java in distributions (#38013)
* Bundle java in distributions Setting up a jdk is currently a required external step when installing elasticsearch. This is particularly problematic for the rpm/deb packages as installing a jdk in the same package installation command does not guarantee any order, so must be done in separate steps. Additionally, JAVA_HOME must be set and often causes problems in selecting a correct jdk when, for example, the system java is an older unsupported version. This commit bundles platform specific openjdks into each distribution. In addition to eliminating the issues above, it also presents future possible improvements like using jlink to build jdk images only containing modules that elasticsearch uses. closes #31845
This commit is contained in:
parent
e0abc3ce96
commit
465343f12a
Vagrantfile
buildSrc
distribution
qa/vagrant/src
main/java/org/elasticsearch/packaging
test
util
test/resources/packaging
server/src/main/java/org/elasticsearch/node
x-pack/plugin/sql/qa
single-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node
src/main/java/org/elasticsearch/xpack/sql/qa/jdbc
6
Vagrantfile
vendored
6
Vagrantfile
vendored
@ -350,6 +350,8 @@ def sh_install_deps(config,
|
|||||||
if [ -z "\\\$JAVA_HOME" ]; then
|
if [ -z "\\\$JAVA_HOME" ]; then
|
||||||
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
|
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
|
||||||
fi
|
fi
|
||||||
|
export SYSTEM_JAVA_HOME=\\\$JAVA_HOME
|
||||||
|
unset JAVA_HOME
|
||||||
JAVA
|
JAVA
|
||||||
ensure tar
|
ensure tar
|
||||||
ensure curl
|
ensure curl
|
||||||
@ -388,6 +390,7 @@ Defaults env_keep += "BATS_TESTS"
|
|||||||
Defaults env_keep += "PACKAGING_ARCHIVES"
|
Defaults env_keep += "PACKAGING_ARCHIVES"
|
||||||
Defaults env_keep += "PACKAGING_TESTS"
|
Defaults env_keep += "PACKAGING_TESTS"
|
||||||
Defaults env_keep += "JAVA_HOME"
|
Defaults env_keep += "JAVA_HOME"
|
||||||
|
Defaults env_keep += "SYSTEM_JAVA_HOME"
|
||||||
SUDOERS_VARS
|
SUDOERS_VARS
|
||||||
chmod 0440 /etc/sudoers.d/elasticsearch_vars
|
chmod 0440 /etc/sudoers.d/elasticsearch_vars
|
||||||
SHELL
|
SHELL
|
||||||
@ -408,6 +411,9 @@ def windows_common(config, name)
|
|||||||
config.vm.provision 'set env variables', type: 'shell', inline: <<-SHELL
|
config.vm.provision 'set env variables', type: 'shell', inline: <<-SHELL
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
[Environment]::SetEnvironmentVariable("PACKAGING_ARCHIVES", "C:/project/build/packaging/archives", "Machine")
|
[Environment]::SetEnvironmentVariable("PACKAGING_ARCHIVES", "C:/project/build/packaging/archives", "Machine")
|
||||||
|
$javaHome = [Environment]::GetEnvironmentVariable("JAVA_HOME", "Machine")
|
||||||
|
[Environment]::SetEnvironmentVariable("SYSTEM_JAVA_HOME", $javaHome, "Machine")
|
||||||
[Environment]::SetEnvironmentVariable("PACKAGING_TESTS", "C:/project/build/packaging/tests", "Machine")
|
[Environment]::SetEnvironmentVariable("PACKAGING_TESTS", "C:/project/build/packaging/tests", "Machine")
|
||||||
|
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine")
|
||||||
SHELL
|
SHELL
|
||||||
end
|
end
|
||||||
|
@ -213,6 +213,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||||||
project.rootProject.ext.runtimeJavaHome = runtimeJavaHome
|
project.rootProject.ext.runtimeJavaHome = runtimeJavaHome
|
||||||
project.rootProject.ext.compilerJavaVersion = compilerJavaVersionEnum
|
project.rootProject.ext.compilerJavaVersion = compilerJavaVersionEnum
|
||||||
project.rootProject.ext.runtimeJavaVersion = runtimeJavaVersionEnum
|
project.rootProject.ext.runtimeJavaVersion = runtimeJavaVersionEnum
|
||||||
|
project.rootProject.ext.isRuntimeJavaHomeSet = compilerJavaHome.equals(runtimeJavaHome) == false
|
||||||
project.rootProject.ext.javaVersions = javaVersions
|
project.rootProject.ext.javaVersions = javaVersions
|
||||||
project.rootProject.ext.buildChecksDone = true
|
project.rootProject.ext.buildChecksDone = true
|
||||||
project.rootProject.ext.minimumCompilerVersion = minimumCompilerVersion
|
project.rootProject.ext.minimumCompilerVersion = minimumCompilerVersion
|
||||||
@ -231,6 +232,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||||||
project.ext.runtimeJavaHome = project.rootProject.ext.runtimeJavaHome
|
project.ext.runtimeJavaHome = project.rootProject.ext.runtimeJavaHome
|
||||||
project.ext.compilerJavaVersion = project.rootProject.ext.compilerJavaVersion
|
project.ext.compilerJavaVersion = project.rootProject.ext.compilerJavaVersion
|
||||||
project.ext.runtimeJavaVersion = project.rootProject.ext.runtimeJavaVersion
|
project.ext.runtimeJavaVersion = project.rootProject.ext.runtimeJavaVersion
|
||||||
|
project.ext.isRuntimeJavaHomeSet = project.rootProject.ext.isRuntimeJavaHomeSet
|
||||||
project.ext.javaVersions = project.rootProject.ext.javaVersions
|
project.ext.javaVersions = project.rootProject.ext.javaVersions
|
||||||
project.ext.inFipsJvm = project.rootProject.ext.inFipsJvm
|
project.ext.inFipsJvm = project.rootProject.ext.inFipsJvm
|
||||||
project.ext.gradleJavaVersion = project.rootProject.ext.gradleJavaVersion
|
project.ext.gradleJavaVersion = project.rootProject.ext.gradleJavaVersion
|
||||||
|
@ -681,7 +681,13 @@ class ClusterFormationTasks {
|
|||||||
static Task configureExecTask(String name, Project project, Task setup, NodeInfo node, Object[] execArgs) {
|
static Task configureExecTask(String name, Project project, Task setup, NodeInfo node, Object[] execArgs) {
|
||||||
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) { Exec exec ->
|
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) { Exec exec ->
|
||||||
exec.workingDir node.cwd
|
exec.workingDir node.cwd
|
||||||
exec.environment 'JAVA_HOME', node.getJavaHome()
|
// TODO: this must change to 7.0.0 after bundling java has been backported
|
||||||
|
if (project.isRuntimeJavaHomeSet || node.nodeVersion.before(Version.fromString("8.0.0"))) {
|
||||||
|
exec.environment.put('JAVA_HOME', project.runtimeJavaHome)
|
||||||
|
} else {
|
||||||
|
// force JAVA_HOME to *not* be set
|
||||||
|
exec.environment.remove('JAVA_HOME')
|
||||||
|
}
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
exec.executable 'cmd'
|
exec.executable 'cmd'
|
||||||
exec.args '/C', 'call'
|
exec.args '/C', 'call'
|
||||||
@ -698,8 +704,12 @@ class ClusterFormationTasks {
|
|||||||
static Task configureStartTask(String name, Project project, Task setup, NodeInfo node) {
|
static Task configureStartTask(String name, Project project, Task setup, NodeInfo node) {
|
||||||
// this closure is converted into ant nodes by groovy's AntBuilder
|
// this closure is converted into ant nodes by groovy's AntBuilder
|
||||||
Closure antRunner = { AntBuilder ant ->
|
Closure antRunner = { AntBuilder ant ->
|
||||||
ant.exec(executable: node.executable, spawn: node.config.daemonize, dir: node.cwd, taskname: 'elasticsearch') {
|
ant.exec(executable: node.executable, spawn: node.config.daemonize, newenvironment: true,
|
||||||
|
dir: node.cwd, taskname: 'elasticsearch') {
|
||||||
node.env.each { key, value -> env(key: key, value: value) }
|
node.env.each { key, value -> env(key: key, value: value) }
|
||||||
|
if (project.isRuntimeJavaHomeSet || node.nodeVersion.before(Version.fromString("8.0.0"))) {
|
||||||
|
env(key: 'JAVA_HOME', value: project.runtimeJavaHome)
|
||||||
|
}
|
||||||
node.args.each { arg(value: it) }
|
node.args.each { arg(value: it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import com.sun.jna.Native
|
|||||||
import com.sun.jna.WString
|
import com.sun.jna.WString
|
||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
import org.elasticsearch.gradle.Version
|
import org.elasticsearch.gradle.Version
|
||||||
import org.gradle.api.InvalidUserDataException
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
@ -240,11 +239,6 @@ class NodeInfo {
|
|||||||
return Native.toString(shortPath).substring(4)
|
return Native.toString(shortPath).substring(4)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the java home used by this node. */
|
|
||||||
String getJavaHome() {
|
|
||||||
return javaVersion == null ? project.runtimeJavaHome : project.javaVersions.get(javaVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns debug string for the command that started this node. */
|
/** Returns debug string for the command that started this node. */
|
||||||
String getCommandString() {
|
String getCommandString() {
|
||||||
String esCommandString = "\nNode ${nodeNum} configuration:\n"
|
String esCommandString = "\nNode ${nodeNum} configuration:\n"
|
||||||
@ -252,7 +246,6 @@ class NodeInfo {
|
|||||||
esCommandString += "| cwd: ${cwd}\n"
|
esCommandString += "| cwd: ${cwd}\n"
|
||||||
esCommandString += "| command: ${executable} ${args.join(' ')}\n"
|
esCommandString += "| command: ${executable} ${args.join(' ')}\n"
|
||||||
esCommandString += '| environment:\n'
|
esCommandString += '| environment:\n'
|
||||||
esCommandString += "| JAVA_HOME: ${javaHome}\n"
|
|
||||||
env.each { k, v -> esCommandString += "| ${k}: ${v}\n" }
|
env.each { k, v -> esCommandString += "| ${k}: ${v}\n" }
|
||||||
if (config.daemonize) {
|
if (config.daemonize) {
|
||||||
esCommandString += "|\n| [${wrapperScript.name}]\n"
|
esCommandString += "|\n| [${wrapperScript.name}]\n"
|
||||||
|
@ -10,6 +10,7 @@ import java.util.Properties;
|
|||||||
* Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions.
|
* Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions.
|
||||||
*/
|
*/
|
||||||
public class VersionProperties {
|
public class VersionProperties {
|
||||||
|
|
||||||
public static String getElasticsearch() {
|
public static String getElasticsearch() {
|
||||||
return elasticsearch;
|
return elasticsearch;
|
||||||
}
|
}
|
||||||
@ -18,17 +19,25 @@ public class VersionProperties {
|
|||||||
return lucene;
|
return lucene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getBundledJdk() {
|
||||||
|
return bundledJdk;
|
||||||
|
}
|
||||||
|
|
||||||
public static Map<String, String> getVersions() {
|
public static Map<String, String> getVersions() {
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String elasticsearch;
|
private static final String elasticsearch;
|
||||||
private static final String lucene;
|
private static final String lucene;
|
||||||
|
private static final String bundledJdk;
|
||||||
private static final Map<String, String> versions = new HashMap<String, String>();
|
private static final Map<String, String> versions = new HashMap<String, String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Properties props = getVersionProperties();
|
Properties props = getVersionProperties();
|
||||||
elasticsearch = props.getProperty("elasticsearch");
|
elasticsearch = props.getProperty("elasticsearch");
|
||||||
lucene = props.getProperty("lucene");
|
lucene = props.getProperty("lucene");
|
||||||
|
bundledJdk = props.getProperty("bundled_jdk");
|
||||||
|
|
||||||
for (String property : props.stringPropertyNames()) {
|
for (String property : props.stringPropertyNames()) {
|
||||||
versions.put(property, props.getProperty(property));
|
versions.put(property, props.getProperty(property));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
elasticsearch = 7.1.0
|
elasticsearch = 7.1.0
|
||||||
lucene = 8.0.0-snapshot-ff9509a8df
|
lucene = 8.0.0-snapshot-ff9509a8df
|
||||||
|
|
||||||
|
bundled_jdk = 11.0.2+9
|
||||||
|
|
||||||
# optional dependencies
|
# optional dependencies
|
||||||
spatial4j = 0.7
|
spatial4j = 0.7
|
||||||
jts = 1.15.0
|
jts = 1.15.0
|
||||||
|
@ -45,7 +45,7 @@ task createPluginsDir(type: EmptyDirTask) {
|
|||||||
dirMode 0755
|
dirMode 0755
|
||||||
}
|
}
|
||||||
|
|
||||||
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, boolean oss) {
|
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, boolean oss) {
|
||||||
return copySpec {
|
return copySpec {
|
||||||
into("elasticsearch-${version}") {
|
into("elasticsearch-${version}") {
|
||||||
into('lib') {
|
into('lib') {
|
||||||
@ -59,6 +59,11 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, boolean os
|
|||||||
into('bin') {
|
into('bin') {
|
||||||
with binFiles(distributionType, oss)
|
with binFiles(distributionType, oss)
|
||||||
}
|
}
|
||||||
|
if (platform != null) {
|
||||||
|
into('jdk') {
|
||||||
|
with jdkFiles(platform)
|
||||||
|
}
|
||||||
|
}
|
||||||
into('') {
|
into('') {
|
||||||
from {
|
from {
|
||||||
dirMode 0755
|
dirMode 0755
|
||||||
@ -102,19 +107,19 @@ Closure commonZipConfig = {
|
|||||||
|
|
||||||
task buildIntegTestZip(type: Zip) {
|
task buildIntegTestZip(type: Zip) {
|
||||||
configure(commonZipConfig)
|
configure(commonZipConfig)
|
||||||
with archiveFiles(transportModulesFiles, 'zip', true)
|
with archiveFiles(transportModulesFiles, 'zip', null, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildWindowsZip(type: Zip) {
|
task buildWindowsZip(type: Zip) {
|
||||||
configure(commonZipConfig)
|
configure(commonZipConfig)
|
||||||
archiveClassifier = 'windows-x86_64'
|
archiveClassifier = 'windows-x86_64'
|
||||||
with archiveFiles(modulesFiles(false), 'zip', false)
|
with archiveFiles(modulesFiles(false), 'zip', 'windows', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildOssWindowsZip(type: Zip) {
|
task buildOssWindowsZip(type: Zip) {
|
||||||
configure(commonZipConfig)
|
configure(commonZipConfig)
|
||||||
archiveClassifier = 'windows-x86_64'
|
archiveClassifier = 'windows-x86_64'
|
||||||
with archiveFiles(modulesFiles(true), 'zip', true)
|
with archiveFiles(modulesFiles(true), 'zip', 'windows', true)
|
||||||
}
|
}
|
||||||
|
|
||||||
Closure commonTarConfig = {
|
Closure commonTarConfig = {
|
||||||
@ -127,25 +132,25 @@ Closure commonTarConfig = {
|
|||||||
task buildDarwinTar(type: Tar) {
|
task buildDarwinTar(type: Tar) {
|
||||||
configure(commonTarConfig)
|
configure(commonTarConfig)
|
||||||
archiveClassifier = 'darwin-x86_64'
|
archiveClassifier = 'darwin-x86_64'
|
||||||
with archiveFiles(modulesFiles(false), 'tar', false)
|
with archiveFiles(modulesFiles(false), 'tar', 'darwin', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildOssDarwinTar(type: Tar) {
|
task buildOssDarwinTar(type: Tar) {
|
||||||
configure(commonTarConfig)
|
configure(commonTarConfig)
|
||||||
archiveClassifier = 'darwin-x86_64'
|
archiveClassifier = 'darwin-x86_64'
|
||||||
with archiveFiles(modulesFiles(true), 'tar', true)
|
with archiveFiles(modulesFiles(true), 'tar', 'darwin', true)
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildLinuxTar(type: Tar) {
|
task buildLinuxTar(type: Tar) {
|
||||||
configure(commonTarConfig)
|
configure(commonTarConfig)
|
||||||
archiveClassifier = 'linux-x86_64'
|
archiveClassifier = 'linux-x86_64'
|
||||||
with archiveFiles(modulesFiles(false), 'tar', false)
|
with archiveFiles(modulesFiles(false), 'tar', 'linux', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildOssLinuxTar(type: Tar) {
|
task buildOssLinuxTar(type: Tar) {
|
||||||
configure(commonTarConfig)
|
configure(commonTarConfig)
|
||||||
archiveClassifier = 'linux-x86_64'
|
archiveClassifier = 'linux-x86_64'
|
||||||
with archiveFiles(modulesFiles(true), 'tar', true)
|
with archiveFiles(modulesFiles(true), 'tar', 'linux', true)
|
||||||
}
|
}
|
||||||
|
|
||||||
Closure tarExists = { it -> new File('/bin/tar').exists() || new File('/usr/bin/tar').exists() || new File('/usr/local/bin/tar').exists() }
|
Closure tarExists = { it -> new File('/bin/tar').exists() || new File('/usr/bin/tar').exists() || new File('/usr/local/bin/tar').exists() }
|
||||||
|
@ -20,11 +20,14 @@
|
|||||||
import org.elasticsearch.gradle.ConcatFilesTask
|
import org.elasticsearch.gradle.ConcatFilesTask
|
||||||
import org.elasticsearch.gradle.MavenFilteringHack
|
import org.elasticsearch.gradle.MavenFilteringHack
|
||||||
import org.elasticsearch.gradle.NoticeTask
|
import org.elasticsearch.gradle.NoticeTask
|
||||||
|
import org.elasticsearch.gradle.VersionProperties
|
||||||
import org.elasticsearch.gradle.test.RunTask
|
import org.elasticsearch.gradle.test.RunTask
|
||||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import java.util.regex.Matcher
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Third party dependencies report *
|
* Third party dependencies report *
|
||||||
@ -210,6 +213,51 @@ xpack.subprojects.findAll { it.parent == xpack }.each { Project xpackModule ->
|
|||||||
copyLog4jProperties(buildDefaultLog4jConfig, xpackModule)
|
copyLog4jProperties(buildDefaultLog4jConfig, xpackModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* JDKs *
|
||||||
|
*****************************************************************************/
|
||||||
|
// extract the bundled jdk version, broken into elements as: [feature, interim, update, build]
|
||||||
|
// Note the "patch" version is not yet handled here, as it has not yet been used by java.
|
||||||
|
Pattern JDK_VERSION = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)\\+(\\d+)")
|
||||||
|
Matcher jdkVersionMatcher = JDK_VERSION.matcher(VersionProperties.bundledJdk)
|
||||||
|
if (jdkVersionMatcher.matches() == false) {
|
||||||
|
throw new IllegalArgumentException("Malformed jdk version [" + VersionProperties.bundledJdk + "]")
|
||||||
|
}
|
||||||
|
String jdkVersion = jdkVersionMatcher.group(1) + '.' + jdkVersionMatcher.group(2) + '.' + jdkVersionMatcher.group(3)
|
||||||
|
String jdkMajor = jdkVersionMatcher.group(1)
|
||||||
|
String jdkBuild = jdkVersionMatcher.group(4)
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
ivy {
|
||||||
|
url "https://download.java.net"
|
||||||
|
patternLayout {
|
||||||
|
artifact "java/GA/jdk${jdkMajor}/${jdkBuild}/GPL/openjdk-[revision]_[module]-x64_bin.[ext]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String platform : ['linux', 'darwin', 'windows']) {
|
||||||
|
String jdkConfigName = "jdk_${platform}"
|
||||||
|
Configuration jdkConfig = configurations.create(jdkConfigName)
|
||||||
|
String extension = platform.equals('windows') ? 'zip' : 'tar.gz'
|
||||||
|
dependencies.add(jdkConfigName, "jdk:${platform.equals('darwin') ? 'osx' : platform}:${jdkVersion}@${extension}")
|
||||||
|
|
||||||
|
int rootNdx = platform.equals('darwin') ? 2 : 1
|
||||||
|
Closure removeRootDir = {
|
||||||
|
it.eachFile { FileCopyDetails details ->
|
||||||
|
details.relativePath = new RelativePath(true, details.relativePath.segments[rootNdx..-1] as String[])
|
||||||
|
}
|
||||||
|
it.includeEmptyDirs false
|
||||||
|
}
|
||||||
|
project.task("extract${platform.capitalize()}Jdk", type: Copy) {
|
||||||
|
into "${buildDir}/jdks/openjdk-${jdkVersion}_${platform}"
|
||||||
|
if (extension.equals('zip')) {
|
||||||
|
from({ zipTree(jdkConfig.singleFile) }, removeRootDir)
|
||||||
|
} else {
|
||||||
|
from({ tarTree(resources.gzip(jdkConfig.singleFile)) }, removeRootDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// make sure we have a clean task since we aren't a java project, but we have tasks that
|
// make sure we have a clean task since we aren't a java project, but we have tasks that
|
||||||
// put stuff in the build dir
|
// put stuff in the build dir
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
@ -332,6 +380,17 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|||||||
from buildDefaultNotice
|
from buildDefaultNotice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jdkFiles = { platform ->
|
||||||
|
copySpec {
|
||||||
|
from project(':distribution').tasks.getByName("extract${platform.capitalize()}Jdk")
|
||||||
|
eachFile { FileCopyDetails details ->
|
||||||
|
if (details.relativePath.segments[-2] == 'bin') {
|
||||||
|
details.mode = 0755
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,9 @@ Closure commonPackageConfig(String type, boolean oss) {
|
|||||||
into('modules') {
|
into('modules') {
|
||||||
with modulesFiles(oss)
|
with modulesFiles(oss)
|
||||||
}
|
}
|
||||||
|
into('jdk') {
|
||||||
|
with jdkFiles('linux')
|
||||||
|
}
|
||||||
// we need to specify every intermediate directory in these paths so the package managers know they are explicitly
|
// we need to specify every intermediate directory in these paths so the package managers know they are explicitly
|
||||||
// intended to manage them; otherwise they may be left behind on uninstallation. duplicate calls of the same
|
// intended to manage them; otherwise they may be left behind on uninstallation. duplicate calls of the same
|
||||||
// directory are fine
|
// directory are fine
|
||||||
|
@ -15,19 +15,6 @@ err_exit() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for these at preinst time due to failures in postinst if they do not exist
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
elif command -v java; then
|
|
||||||
JAVA=`command -v java`
|
|
||||||
else
|
|
||||||
JAVA=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA" ]; then
|
|
||||||
err_exit "could not find java; set JAVA_HOME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
||||||
# Debian ####################################################
|
# Debian ####################################################
|
||||||
|
@ -36,17 +36,19 @@ ES_HOME=`dirname "$ES_HOME"`
|
|||||||
ES_CLASSPATH="$ES_HOME/lib/*"
|
ES_CLASSPATH="$ES_HOME/lib/*"
|
||||||
|
|
||||||
# now set the path to java
|
# now set the path to java
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
if [ ! -z "$JAVA_HOME" ]; then
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
JAVA="$JAVA_HOME/bin/java"
|
||||||
else
|
else
|
||||||
set +e
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
JAVA=`which java`
|
# OSX has a different structure
|
||||||
echo "warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME"
|
JAVA="$ES_HOME/jdk/Contents/Home/bin/java"
|
||||||
set -e
|
else
|
||||||
|
JAVA="$ES_HOME/jdk/bin/java"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -x "$JAVA" ]; then
|
if [ ! -x "$JAVA" ]; then
|
||||||
echo "could not find java; set JAVA_HOME" >&2
|
echo "could not find java in JAVA_HOME or bundled at $JAVA" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Binary file not shown.
@ -30,12 +30,11 @@ import org.elasticsearch.packaging.util.Shell;
|
|||||||
import org.elasticsearch.packaging.util.Shell.Result;
|
import org.elasticsearch.packaging.util.Shell.Result;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.joining;
|
|
||||||
import static org.elasticsearch.packaging.util.Archives.ARCHIVE_OWNER;
|
import static org.elasticsearch.packaging.util.Archives.ARCHIVE_OWNER;
|
||||||
import static org.elasticsearch.packaging.util.Archives.installArchive;
|
import static org.elasticsearch.packaging.util.Archives.installArchive;
|
||||||
import static org.elasticsearch.packaging.util.Archives.verifyArchiveInstallation;
|
import static org.elasticsearch.packaging.util.Archives.verifyArchiveInstallation;
|
||||||
@ -46,6 +45,7 @@ import static org.elasticsearch.packaging.util.FileUtils.append;
|
|||||||
import static org.elasticsearch.packaging.util.FileUtils.cp;
|
import static org.elasticsearch.packaging.util.FileUtils.cp;
|
||||||
import static org.elasticsearch.packaging.util.FileUtils.getTempDir;
|
import static org.elasticsearch.packaging.util.FileUtils.getTempDir;
|
||||||
import static org.elasticsearch.packaging.util.FileUtils.mkdir;
|
import static org.elasticsearch.packaging.util.FileUtils.mkdir;
|
||||||
|
import static org.elasticsearch.packaging.util.FileUtils.mv;
|
||||||
import static org.elasticsearch.packaging.util.FileUtils.rm;
|
import static org.elasticsearch.packaging.util.FileUtils.rm;
|
||||||
import static org.elasticsearch.packaging.util.ServerUtils.makeRequest;
|
import static org.elasticsearch.packaging.util.ServerUtils.makeRequest;
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
@ -77,46 +77,23 @@ public abstract class ArchiveTestCase extends PackagingTestCase {
|
|||||||
assertThat(r.stdout, isEmptyString());
|
assertThat(r.stdout, isEmptyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test30AbortWhenJavaMissing() {
|
public void test30NoJava() {
|
||||||
assumeThat(installation, is(notNullValue()));
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
final Installation.Executables bin = installation.executables();
|
final Installation.Executables bin = installation.executables();
|
||||||
final Shell sh = new Shell();
|
final Shell sh = new Shell();
|
||||||
|
|
||||||
Platforms.onWindows(() -> {
|
final Path relocatedJdk = installation.bundledJdk.getParent().resolve("jdk.relocated");
|
||||||
// on windows, removing java from PATH and removing JAVA_HOME is less involved than changing the permissions of the java
|
|
||||||
// executable. we also don't check permissions in the windows scripts anyway
|
|
||||||
final String originalPath = sh.run("$Env:PATH").stdout.trim();
|
|
||||||
final String newPath = Arrays.stream(originalPath.split(";"))
|
|
||||||
.filter(path -> path.contains("Java") == false)
|
|
||||||
.collect(joining(";"));
|
|
||||||
|
|
||||||
// note the lack of a $ when clearing the JAVA_HOME env variable - with a $ it deletes the java home directory
|
|
||||||
// https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/providers/environment-provider?view=powershell-6
|
|
||||||
//
|
|
||||||
// this won't persist to another session so we don't have to reset anything
|
|
||||||
final Result runResult = sh.runIgnoreExitCode(
|
|
||||||
"$Env:PATH = '" + newPath + "'; " +
|
|
||||||
"Remove-Item Env:JAVA_HOME; " +
|
|
||||||
bin.elasticsearch
|
|
||||||
);
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
mv(installation.bundledJdk, relocatedJdk);
|
||||||
|
// ask for elasticsearch version to quickly exit if java is actually found (ie test failure)
|
||||||
|
final Result runResult = sh.runIgnoreExitCode(bin.elasticsearch.toString() + " -v");
|
||||||
assertThat(runResult.exitCode, is(1));
|
assertThat(runResult.exitCode, is(1));
|
||||||
assertThat(runResult.stderr, containsString("could not find java; set JAVA_HOME"));
|
assertThat(runResult.stderr, containsString("could not find java in JAVA_HOME or bundled"));
|
||||||
});
|
} finally {
|
||||||
|
mv(relocatedJdk, installation.bundledJdk);
|
||||||
Platforms.onLinux(() -> {
|
}
|
||||||
final String javaPath = sh.run("command -v java").stdout.trim();
|
|
||||||
|
|
||||||
try {
|
|
||||||
sh.run("chmod -x '" + javaPath + "'");
|
|
||||||
final Result runResult = sh.runIgnoreExitCode(bin.elasticsearch.toString());
|
|
||||||
assertThat(runResult.exitCode, is(1));
|
|
||||||
assertThat(runResult.stderr, containsString("could not find java; set JAVA_HOME"));
|
|
||||||
} finally {
|
|
||||||
sh.run("chmod +x '" + javaPath + "'");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test40CreateKeystoreManually() {
|
public void test40CreateKeystoreManually() {
|
||||||
@ -160,15 +137,51 @@ public abstract class ArchiveTestCase extends PackagingTestCase {
|
|||||||
|
|
||||||
Archives.runElasticsearch(installation);
|
Archives.runElasticsearch(installation);
|
||||||
|
|
||||||
final String gcLogName = Platforms.LINUX
|
assertTrue("gc logs exist", Files.exists(installation.logs.resolve("gc.log")));
|
||||||
? "gc.log.0.current"
|
|
||||||
: "gc.log";
|
|
||||||
assertTrue("gc logs exist", Files.exists(installation.logs.resolve(gcLogName)));
|
|
||||||
ServerUtils.runElasticsearchTests();
|
ServerUtils.runElasticsearchTests();
|
||||||
|
|
||||||
Archives.stopElasticsearch(installation);
|
Archives.stopElasticsearch(installation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void assertRunsWithJavaHome() throws IOException {
|
||||||
|
Shell sh = new Shell();
|
||||||
|
|
||||||
|
Platforms.onLinux(() -> {
|
||||||
|
String systemJavaHome = sh.run("echo $SYSTEM_JAVA_HOME").stdout.trim();
|
||||||
|
sh.getEnv().put("JAVA_HOME", systemJavaHome);
|
||||||
|
});
|
||||||
|
Platforms.onWindows(() -> {
|
||||||
|
final String systemJavaHome = sh.run("$Env:SYSTEM_JAVA_HOME").stdout.trim();
|
||||||
|
sh.getEnv().put("JAVA_HOME", systemJavaHome);
|
||||||
|
});
|
||||||
|
|
||||||
|
Archives.runElasticsearch(installation, sh);
|
||||||
|
ServerUtils.runElasticsearchTests();
|
||||||
|
Archives.stopElasticsearch(installation);
|
||||||
|
|
||||||
|
String systemJavaHome = sh.getEnv().get("JAVA_HOME");
|
||||||
|
Path log = installation.logs.resolve("elasticsearch.log");
|
||||||
|
assertThat(new String(Files.readAllBytes(log), StandardCharsets.UTF_8), containsString(systemJavaHome));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test51JavaHomeOverride() throws IOException {
|
||||||
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
|
assertRunsWithJavaHome();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test52BundledJdkRemoved() throws IOException {
|
||||||
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
|
Path relocatedJdk = installation.bundledJdk.getParent().resolve("jdk.relocated");
|
||||||
|
try {
|
||||||
|
mv(installation.bundledJdk, relocatedJdk);
|
||||||
|
assertRunsWithJavaHome();
|
||||||
|
} finally {
|
||||||
|
mv(relocatedJdk, installation.bundledJdk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void test60AutoCreateKeystore() {
|
public void test60AutoCreateKeystore() {
|
||||||
assumeThat(installation, is(notNullValue()));
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
|
@ -25,9 +25,10 @@ import org.elasticsearch.packaging.util.Shell.Result;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -38,8 +39,8 @@ import static org.elasticsearch.packaging.util.Packages.assertInstalled;
|
|||||||
import static org.elasticsearch.packaging.util.Packages.assertRemoved;
|
import static org.elasticsearch.packaging.util.Packages.assertRemoved;
|
||||||
import static org.elasticsearch.packaging.util.Packages.install;
|
import static org.elasticsearch.packaging.util.Packages.install;
|
||||||
import static org.elasticsearch.packaging.util.Packages.remove;
|
import static org.elasticsearch.packaging.util.Packages.remove;
|
||||||
import static org.elasticsearch.packaging.util.Packages.runInstallCommand;
|
|
||||||
import static org.elasticsearch.packaging.util.Packages.startElasticsearch;
|
import static org.elasticsearch.packaging.util.Packages.startElasticsearch;
|
||||||
|
import static org.elasticsearch.packaging.util.Packages.stopElasticsearch;
|
||||||
import static org.elasticsearch.packaging.util.Packages.verifyPackageInstallation;
|
import static org.elasticsearch.packaging.util.Packages.verifyPackageInstallation;
|
||||||
import static org.elasticsearch.packaging.util.Platforms.getOsRelease;
|
import static org.elasticsearch.packaging.util.Platforms.getOsRelease;
|
||||||
import static org.elasticsearch.packaging.util.Platforms.isSystemd;
|
import static org.elasticsearch.packaging.util.Platforms.isSystemd;
|
||||||
@ -60,23 +61,6 @@ public abstract class PackageTestCase extends PackagingTestCase {
|
|||||||
assumeTrue("only compatible distributions", distribution().packaging.compatible);
|
assumeTrue("only compatible distributions", distribution().packaging.compatible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test05InstallFailsWhenJavaMissing() {
|
|
||||||
final Shell sh = new Shell();
|
|
||||||
final Result javaHomeOutput = sh.run("echo $JAVA_HOME");
|
|
||||||
|
|
||||||
final Path javaHome = Paths.get(javaHomeOutput.stdout.trim());
|
|
||||||
final Path originalJavaPath = javaHome.resolve("bin").resolve("java");
|
|
||||||
final Path relocatedJavaPath = javaHome.resolve("bin").resolve("java.relocated");
|
|
||||||
try {
|
|
||||||
mv(originalJavaPath, relocatedJavaPath);
|
|
||||||
final Result installResult = runInstallCommand(distribution());
|
|
||||||
assertThat(installResult.exitCode, is(1));
|
|
||||||
assertThat(installResult.stderr, containsString("could not find java; set JAVA_HOME"));
|
|
||||||
} finally {
|
|
||||||
mv(relocatedJavaPath, originalJavaPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test10InstallPackage() {
|
public void test10InstallPackage() {
|
||||||
assertRemoved(distribution());
|
assertRemoved(distribution());
|
||||||
installation = install(distribution());
|
installation = install(distribution());
|
||||||
@ -98,6 +82,43 @@ public abstract class PackageTestCase extends PackagingTestCase {
|
|||||||
assertThat(sh.run("ps aux").stdout, not(containsString("org.elasticsearch.bootstrap.Elasticsearch")));
|
assertThat(sh.run("ps aux").stdout, not(containsString("org.elasticsearch.bootstrap.Elasticsearch")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void assertRunsWithJavaHome() throws IOException {
|
||||||
|
Shell sh = new Shell();
|
||||||
|
|
||||||
|
String systemJavaHome = sh.run("echo $SYSTEM_JAVA_HOME").stdout.trim();
|
||||||
|
byte[] originalEnvFile = Files.readAllBytes(installation.envFile);
|
||||||
|
try {
|
||||||
|
Files.write(installation.envFile, ("JAVA_HOME=" + systemJavaHome + "\n").getBytes(StandardCharsets.UTF_8),
|
||||||
|
StandardOpenOption.APPEND);
|
||||||
|
startElasticsearch();
|
||||||
|
runElasticsearchTests();
|
||||||
|
stopElasticsearch();
|
||||||
|
} finally {
|
||||||
|
Files.write(installation.envFile, originalEnvFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
Path log = installation.logs.resolve("elasticsearch.log");
|
||||||
|
assertThat(new String(Files.readAllBytes(log), StandardCharsets.UTF_8), containsString(systemJavaHome));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test31JavaHomeOverride() throws IOException {
|
||||||
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
|
assertRunsWithJavaHome();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test42BundledJdkRemoved() throws IOException {
|
||||||
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
|
Path relocatedJdk = installation.bundledJdk.getParent().resolve("jdk.relocated");
|
||||||
|
try {
|
||||||
|
mv(installation.bundledJdk, relocatedJdk);
|
||||||
|
assertRunsWithJavaHome();
|
||||||
|
} finally {
|
||||||
|
mv(relocatedJdk, installation.bundledJdk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void test40StartServer() throws IOException {
|
public void test40StartServer() throws IOException {
|
||||||
assumeThat(installation, is(notNullValue()));
|
assumeThat(installation, is(notNullValue()));
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ import java.nio.file.Path;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.carrotsearch.randomizedtesting.RandomizedTest.assumeTrue;
|
import static com.carrotsearch.randomizedtesting.RandomizedTest.assumeTrue;
|
||||||
import static java.util.stream.Collectors.joining;
|
|
||||||
import static org.elasticsearch.packaging.util.Archives.installArchive;
|
import static org.elasticsearch.packaging.util.Archives.installArchive;
|
||||||
import static org.elasticsearch.packaging.util.Archives.verifyArchiveInstallation;
|
import static org.elasticsearch.packaging.util.Archives.verifyArchiveInstallation;
|
||||||
|
import static org.elasticsearch.packaging.util.FileUtils.mv;
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
@ -65,22 +65,15 @@ public abstract class WindowsServiceTestCase extends PackagingTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Result runWithoutJava(String script) {
|
private Result runWithoutJava(String script) {
|
||||||
// on windows, removing java from PATH and removing JAVA_HOME is less involved than changing the permissions of the java
|
final Path relocatedJdk = installation.bundledJdk.getParent().resolve("jdk.relocated");
|
||||||
// executable. we also don't check permissions in the windows scripts anyway
|
|
||||||
final String originalPath = sh.run("$Env:PATH").stdout.trim();
|
|
||||||
final String newPath = Arrays.stream(originalPath.split(";"))
|
|
||||||
.filter(path -> path.contains("Java") == false)
|
|
||||||
.collect(joining(";"));
|
|
||||||
|
|
||||||
// note the lack of a $ when clearing the JAVA_HOME env variable - with a $ it deletes the java home directory
|
try {
|
||||||
// https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/providers/environment-provider?view=powershell-6
|
mv(installation.bundledJdk, relocatedJdk);
|
||||||
//
|
// ask for elasticsearch version to quickly exit if java is actually found (ie test failure)
|
||||||
// this won't persist to another session so we don't have to reset anything
|
return sh.runIgnoreExitCode(script);
|
||||||
return sh.runIgnoreExitCode(
|
} finally {
|
||||||
"$Env:PATH = '" + newPath + "'; " +
|
mv(relocatedJdk, installation.bundledJdk);
|
||||||
"Remove-Item Env:JAVA_HOME; " +
|
}
|
||||||
script
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertService(String id, String status, String displayName) {
|
private void assertService(String id, String status, String displayName) {
|
||||||
@ -135,7 +128,7 @@ public abstract class WindowsServiceTestCase extends PackagingTestCase {
|
|||||||
public void test13InstallMissingJava() throws IOException {
|
public void test13InstallMissingJava() throws IOException {
|
||||||
Result result = runWithoutJava(serviceScript + " install");
|
Result result = runWithoutJava(serviceScript + " install");
|
||||||
assertThat(result.exitCode, equalTo(1));
|
assertThat(result.exitCode, equalTo(1));
|
||||||
assertThat(result.stderr, containsString("could not find java; set JAVA_HOME"));
|
assertThat(result.stderr, containsString("could not find java in JAVA_HOME or bundled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test14RemoveNotInstalled() {
|
public void test14RemoveNotInstalled() {
|
||||||
|
@ -30,6 +30,7 @@ public class Installation {
|
|||||||
public final Path home;
|
public final Path home;
|
||||||
public final Path bin; // this isn't a first-class installation feature but we include it for convenience
|
public final Path bin; // this isn't a first-class installation feature but we include it for convenience
|
||||||
public final Path lib; // same
|
public final Path lib; // same
|
||||||
|
public final Path bundledJdk;
|
||||||
public final Path config;
|
public final Path config;
|
||||||
public final Path data;
|
public final Path data;
|
||||||
public final Path logs;
|
public final Path logs;
|
||||||
@ -42,7 +43,7 @@ public class Installation {
|
|||||||
this.home = home;
|
this.home = home;
|
||||||
this.bin = home.resolve("bin");
|
this.bin = home.resolve("bin");
|
||||||
this.lib = home.resolve("lib");
|
this.lib = home.resolve("lib");
|
||||||
|
this.bundledJdk = home.resolve("jdk");
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.logs = logs;
|
this.logs = logs;
|
||||||
|
@ -283,4 +283,13 @@ public class Packages {
|
|||||||
sh.run("service elasticsearch status");
|
sh.run("service elasticsearch status");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void stopElasticsearch() throws IOException {
|
||||||
|
final Shell sh = new Shell();
|
||||||
|
if (isSystemd()) {
|
||||||
|
sh.run("systemctl stop elasticsearch.service");
|
||||||
|
} else {
|
||||||
|
sh.run("service elasticsearch stop");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,7 @@ public class Shell {
|
|||||||
ProcessBuilder builder = new ProcessBuilder();
|
ProcessBuilder builder = new ProcessBuilder();
|
||||||
builder.command(command);
|
builder.command(command);
|
||||||
|
|
||||||
|
|
||||||
if (workingDirectory != null) {
|
if (workingDirectory != null) {
|
||||||
setWorkingDirectory(builder, workingDirectory);
|
setWorkingDirectory(builder, workingDirectory);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,9 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "[UPGRADE] start old version" {
|
@test "[UPGRADE] start old version" {
|
||||||
|
export JAVA_HOME=$SYSTEM_JAVA_HOME
|
||||||
start_elasticsearch_service
|
start_elasticsearch_service
|
||||||
|
unset JAVA_HOME
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "[UPGRADE] check elasticsearch version is old version" {
|
@test "[UPGRADE] check elasticsearch version is old version" {
|
||||||
|
@ -162,22 +162,6 @@ fi
|
|||||||
remove_plugin_example
|
remove_plugin_example
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "[$GROUP] fail if java executable is not found" {
|
|
||||||
[ "$GROUP" == "TAR PLUGINS" ] || skip "Test case only supported by TAR PLUGINS"
|
|
||||||
local JAVA=$(which java)
|
|
||||||
|
|
||||||
sudo chmod -x $JAVA
|
|
||||||
run "$ESHOME/bin/elasticsearch-plugin"
|
|
||||||
sudo chmod +x $JAVA
|
|
||||||
|
|
||||||
[ "$status" -eq 1 ]
|
|
||||||
local expected="could not find java; set JAVA_HOME"
|
|
||||||
[[ "$output" == *"$expected"* ]] || {
|
|
||||||
echo "Expected error message [$expected] but found: $output"
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Note that all of the tests from here to the end of the file expect to be run
|
# Note that all of the tests from here to the end of the file expect to be run
|
||||||
# in sequence and don't take well to being run one at a time.
|
# in sequence and don't take well to being run one at a time.
|
||||||
@test "[$GROUP] install a sample plugin" {
|
@test "[$GROUP] install a sample plugin" {
|
||||||
|
@ -100,7 +100,7 @@ install_package() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# pass through java home to package
|
# pass through java home to package
|
||||||
echo "JAVA_HOME=\"$JAVA_HOME\"" >> $(env_file)
|
echo "JAVA_HOME=\"$SYSTEM_JAVA_HOME\"" >> $(env_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks that all directories & files are correctly installed after a deb or
|
# Checks that all directories & files are correctly installed after a deb or
|
||||||
|
@ -289,6 +289,7 @@ public class Node implements Closeable {
|
|||||||
Constants.JVM_NAME,
|
Constants.JVM_NAME,
|
||||||
Constants.JAVA_VERSION,
|
Constants.JAVA_VERSION,
|
||||||
Constants.JVM_VERSION);
|
Constants.JVM_VERSION);
|
||||||
|
logger.info("JVM Home [{}]", System.getProperty("java.home"));
|
||||||
logger.info("JVM arguments {}", Arrays.toString(jvmInfo.getInputArguments()));
|
logger.info("JVM arguments {}", Arrays.toString(jvmInfo.getInputArguments()));
|
||||||
if (Build.CURRENT.isProductionRelease() == false) {
|
if (Build.CURRENT.isProductionRelease() == false) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
|
@ -69,7 +69,7 @@ public class JdbcDocCsvSpecIT extends SpecBaseIntegrationTestCase {
|
|||||||
// uncomment this to printout the result set and create new CSV tests
|
// uncomment this to printout the result set and create new CSV tests
|
||||||
//
|
//
|
||||||
//JdbcTestUtils.logLikeCLI(elastic, log);
|
//JdbcTestUtils.logLikeCLI(elastic, log);
|
||||||
JdbcAssert.assertResultSets(expected, elastic, log, true, false);
|
JdbcAssert.assertResultSets(expected, elastic, log, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,6 +66,6 @@ public abstract class CsvSpecTestCase extends SpecBaseIntegrationTestCase {
|
|||||||
@Override
|
@Override
|
||||||
protected void assertResults(ResultSet expected, ResultSet elastic) throws SQLException {
|
protected void assertResults(ResultSet expected, ResultSet elastic) throws SQLException {
|
||||||
Logger log = logEsResultSet() ? logger : null;
|
Logger log = logEsResultSet() ? logger : null;
|
||||||
JdbcAssert.assertResultSets(expected, elastic, log, false, false);
|
JdbcAssert.assertResultSets(expected, elastic, log, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user