Skip to content

Commit e71bc47

Browse files
committed
Merge pull request #13821 from nik9000/jayatana_test
Test that Jayatana is ignored
2 parents ed7c051 + e45b2f7 commit e71bc47

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Vagrantfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ Vagrant.configure(2) do |config|
3232
end
3333
config.vm.define "vivid" do |config|
3434
config.vm.box = "ubuntu/vivid64"
35-
ubuntu_common config
35+
ubuntu_common config, extra: <<-SHELL
36+
# Install Jayatana so we can work around it being present.
37+
[ -f /usr/share/java/jayatanaag.jar ] || install jayatana
38+
SHELL
3639
end
3740
# Wheezy's backports don't contain Openjdk 8 and the backflips required to
3841
# get the sun jdk on there just aren't worth it. We have jessie for testing
@@ -116,11 +119,11 @@ SOURCE_PROMPT
116119
end
117120
end
118121

119-
def ubuntu_common(config)
120-
deb_common config, 'apt-add-repository -y ppa:openjdk-r/ppa > /dev/null 2>&1', 'openjdk-r-*'
122+
def ubuntu_common(config, extra: '')
123+
deb_common config, 'apt-add-repository -y ppa:openjdk-r/ppa > /dev/null 2>&1', 'openjdk-r-*', extra: extra
121124
end
122125

123-
def deb_common(config, add_openjdk_repository_command, openjdk_list)
126+
def deb_common(config, add_openjdk_repository_command, openjdk_list, extra: '')
124127
# http://foo-o-rama.com/vagrant--stdin-is-not-a-tty--fix.html
125128
config.vm.provision "fix-no-tty", type: "shell" do |s|
126129
s.privileged = false
@@ -137,6 +140,7 @@ def deb_common(config, add_openjdk_repository_command, openjdk_list)
137140
(echo "Importing java-8 ppa" &&
138141
#{add_openjdk_repository_command} &&
139142
apt-get update)
143+
#{extra}
140144
SHELL
141145
)
142146
end

qa/vagrant/src/test/resources/packaging/scripts/packaging_test_utils.bash

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,14 @@ start_elasticsearch_service() {
243243
# su and the Elasticsearch init script work together to break bats.
244244
# sudo isolates bats enough from the init script so everything continues
245245
# to tick along
246-
sudo -u elasticsearch /tmp/elasticsearch/bin/elasticsearch -d \
247-
-p /tmp/elasticsearch/elasticsearch.pid
246+
sudo -u elasticsearch bash <<BASH
247+
# If jayatana is installed then we try to use it. Elasticsearch should ignore it even when we try.
248+
# If it doesn't ignore it then Elasticsearch will fail to start because of security errors.
249+
# This line is attempting to emulate the on login behavior of /usr/share/upstart/sessions/jayatana.conf
250+
[ -f /usr/share/java/jayatanaag.jar ] && export JAVA_TOOL_OPTIONS="-javaagent:/usr/share/java/jayatanaag.jar"
251+
# And now we can start Elasticsearch normally, in the background (-d) and with a pidfile (-p).
252+
/tmp/elasticsearch/bin/elasticsearch -d -p /tmp/elasticsearch/elasticsearch.pid
253+
BASH
248254
elif is_systemd; then
249255
run systemctl daemon-reload
250256
[ "$status" -eq 0 ]

0 commit comments

Comments
 (0)