1
0
Эх сурвалжийг харах

Adapt ES_JVM_OPTIONS packaging test to ubuntu-1204

This commit adapts the "[INIT.D] start Elasticsearch with custom JVM options" packaging test so that it works on ubuntu-1204.

Related to #21445
Tanguy Leroux 9 жил өмнө
parent
commit
3f7f8e4b97

+ 5 - 4
qa/vagrant/src/test/resources/packaging/scripts/70_sysv_initd.bats

@@ -135,6 +135,7 @@ setup() {
 }
 
 @test "[INIT.D] start Elasticsearch with custom JVM options" {
+    assert_file_exist $ESENVFILE
     local es_java_opts=$ES_JAVA_OPTS
     local es_jvm_options=$ES_JVM_OPTIONS
     local temp=`mktemp -d`
@@ -142,15 +143,15 @@ setup() {
     chown -R elasticsearch:elasticsearch "$temp"
     echo "-Xms512m" >> "$temp/jvm.options"
     echo "-Xmx512m" >> "$temp/jvm.options"
-    cp /etc/sysconfig/elasticsearch "$temp/elasticsearch"
-    echo "ES_JVM_OPTIONS=\"$temp/jvm.options\"" >> /etc/sysconfig/elasticsearch
-    echo "ES_JAVA_OPTS=\"-XX:-UseCompressedOops\"" >> /etc/sysconfig/elasticsearch
+    cp $ESENVFILE "$temp/elasticsearch"
+    echo "ES_JVM_OPTIONS=\"$temp/jvm.options\"" >> $ESENVFILE
+    echo "ES_JAVA_OPTS=\"-XX:-UseCompressedOops\"" >> $ESENVFILE
     service elasticsearch start
     wait_for_elasticsearch_status
     curl -s -XGET localhost:9200/_nodes | fgrep '"heap_init_in_bytes":536870912'
     curl -s -XGET localhost:9200/_nodes | fgrep '"using_compressed_ordinary_object_pointers":"false"'
     service elasticsearch stop
-    cp "$temp/elasticsearch" /etc/sysconfig/elasticsearch
+    cp "$temp/elasticsearch" $ESENVFILE
 }
 
 # Simulates the behavior of a system restart:

+ 6 - 0
qa/vagrant/src/test/resources/packaging/scripts/os_package.bash

@@ -36,6 +36,12 @@ export_elasticsearch_paths() {
     export ESDATA="/var/lib/elasticsearch"
     export ESLOG="/var/log/elasticsearch"
     export ESPIDDIR="/var/run/elasticsearch"
+    if is_dpkg; then
+        export ESENVFILE="/etc/default/elasticsearch"
+    fi
+    if is_rpm; then
+        export ESENVFILE="/etc/sysconfig/elasticsearch"
+    fi
 }
 
 # Install the rpm or deb package.