Skip to content

Commit

Permalink
[test] use sun-java-formula for Java install (#25)
Browse files Browse the repository at this point in the history
JAVA_HOME is also managed now.
  • Loading branch information
blbradley authored Jan 29, 2017
1 parent ac6ab69 commit f340f8b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.kitchen/
.ruby-version
junit*.xml
vendor/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
18 changes: 10 additions & 8 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@ driver:
name: docker
use_sudo: false
privileged: true
provision_command:
- locale-gen en_US.UTF-8
- apt-get update # base image is out of date
- apt-get install -y software-properties-common # required for add-apt-repository
- add-apt-repository -y ppa:openjdk-r/ppa
- apt-get update
- apt-get install -y openjdk-8-jre-headless
- update-ca-certificates -f

provisioner:
name: salt_solo
require_chef: false
formula: elasticsearch
dependencies:
- name: sun-java
path: vendor/sun-java-formula
state_top:
base:
'*':
- sun-java
- sun-java.env
- elasticsearch

platforms:
- name: ubuntu-14.04
driver_config:
provision_command:
- locale-gen en_US.UTF-8
- name: ubuntu-16.04
driver_config:
provision_command:
- locale-gen en_US.UTF-8
run_command: /sbin/init

suites:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ services:
before_install:
- pip install -r requirements.txt

script: bundle exec kitchen verify
script: ./test/run.sh
10 changes: 10 additions & 0 deletions elasticsearch/sysconfig.sls
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ include:
- context:
sysconfig: {{ salt['pillar.get']('elasticsearch:sysconfig') }}
{% endif %}

{%- set java_home = salt['pillar.get']('elasticsearch:java_home', '/usr/lib/java') %}
manage Elasticsearch JAVA_HOME in environment file:
file.replace:
- name: {{ sysconfig_file }}
- pattern: ^[\s#]*JAVA_HOME=.*$
- repl: JAVA_HOME={{ java_home }}
- prepend_if_not_found: true
- watch_in:
- service: elasticsearch
1 change: 1 addition & 0 deletions pillar.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
elasticsearch:
major_version: 2
java_home: /usr/bin/java
config:
cluster.name: my-application
node.name: node2
Expand Down
5 changes: 5 additions & 0 deletions test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -ev

git clone https://github.com/saltstack-formulas/sun-java-formula vendor/sun-java-formula
bundle exec kitchen verify

0 comments on commit f340f8b

Please sign in to comment.