Skip to content

Commit

Permalink
Merge pull request #1088 from fatmcgav/add_es7_test_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Williams authored Jul 9, 2020
2 parents 82b5380 + 5d8f7f6 commit 873058e
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 212 deletions.
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,87 @@ jobs:
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:amazonlinux-1-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:amazonlinux-1-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:amazonlinux-2-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:amazonlinux-2-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:centos-6-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:centos-6-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:centos-7-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:centos-7-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:centos-8-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:centos-8-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:oracle-6-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:oracle-6-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:oracle-7-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:oracle-7-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:debian-8-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:debian-8-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:debian-9-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:debian-9-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:debian-10-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:debian-10-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:ubuntu-server-1404-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:ubuntu-server-1404-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:ubuntu-server-1604-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:ubuntu-server-1604-x64:acceptance[7.8.0]
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:ubuntu-server-1804-x64:acceptance
- env:
- BEAKER_PUPPET_COLLECTION=puppet6
- TASK=beaker:ubuntu-server-1804-x64:acceptance[7.8.0]
# - env:
# - BEAKER_PUPPET_COLLECTION=puppet6
# - TASK=beaker:ubuntu-server-2004-x64:acceptance
# - env:
# - BEAKER_PUPPET_COLLECTION=puppet6
# - TASK=beaker:ubuntu-server-2004-x64:acceptance[7.8.0]
- stage: snapshots
env:
- TASK=beaker:ubuntu-server-1404-x64:snapshot
Expand Down
75 changes: 24 additions & 51 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
$elasticsearch::datadir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user;
owner => $elasticsearch::elasticsearch_user,
mode => '2750';
$elasticsearch::logdir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
mode => '0750';
mode => '2750';
$elasticsearch::real_plugindir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
Expand All @@ -60,60 +61,19 @@
recurse => true;
}

if $elasticsearch::pid_dir {
file { $elasticsearch::pid_dir:
ensure => 'directory',
group => undef,
owner => $elasticsearch::elasticsearch_user,
recurse => true,
}

if ($elasticsearch::service_provider == 'systemd') {
$group = $elasticsearch::elasticsearch_group
$user = $elasticsearch::elasticsearch_user
$pid_dir = $elasticsearch::pid_dir

file { '/usr/lib/tmpfiles.d/elasticsearch.conf':
ensure => 'file',
content => template("${module_name}/usr/lib/tmpfiles.d/elasticsearch.conf.erb"),
group => '0',
owner => 'root',
}
}
}

if $elasticsearch::defaults_location {
augeas { "${elasticsearch::defaults_location}/elasticsearch":
incl => "${elasticsearch::defaults_location}/elasticsearch",
lens => 'Shellvars.lns',
changes => [
'rm CONF_FILE',
'rm CONF_DIR',
'rm ES_PATH_CONF',
],
}

file { "${elasticsearch::defaults_location}/elasticsearch":
ensure => 'file',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
mode => '0640';
}
}

# Defaults file, either from file source or from hash to augeas commands
if ($elasticsearch::init_defaults_file != undef) {
file { "${elasticsearch::defaults_location}/elasticsearch":
ensure => $elasticsearch::ensure,
source => $elasticsearch::init_defaults_file,
owner => 'root',
group => '0',
mode => '0644',
group => $elasticsearch::elasticsearch_group,
mode => '0660',
before => Service['elasticsearch'],
notify => $elasticsearch::_notify_service,
}
} else {
augeas { 'init_defaults':
augeas { "${elasticsearch::defaults_location}/elasticsearch":
incl => "${elasticsearch::defaults_location}/elasticsearch",
lens => 'Shellvars.lns',
changes => template("${module_name}/etc/sysconfig/defaults.erb"),
Expand All @@ -137,11 +97,24 @@
$_keystore_path = $elasticsearch::keystore_path
}

$_tls_config = {
'xpack.security.transport.ssl.enabled' => true,
'xpack.security.http.ssl.enabled' => true,
'xpack.ssl.keystore.path' => $_keystore_path,
'xpack.ssl.keystore.password' => $elasticsearch::keystore_password,
# Set the correct xpack. settings based on ES version
if (versioncmp($elasticsearch::version, '7') >= 0) {
$_tls_config = {
'xpack.security.http.ssl.enabled' => true,
'xpack.security.http.ssl.keystore.path' => $_keystore_path,
'xpack.security.http.ssl.keystore.password' => $elasticsearch::keystore_password,
'xpack.security.transport.ssl.enabled' => true,
'xpack.security.transport.ssl.keystore.path' => $_keystore_path,
'xpack.security.transport.ssl.keystore.password' => $elasticsearch::keystore_password,
}
}
else {
$_tls_config = {
'xpack.security.transport.ssl.enabled' => true,
'xpack.security.http.ssl.enabled' => true,
'xpack.ssl.keystore.path' => $_keystore_path,
'xpack.ssl.keystore.password' => $elasticsearch::keystore_password,
}
}

# Trust CA Certificate
Expand Down
17 changes: 17 additions & 0 deletions spec/acceptance/nodesets/ubuntu-server-2004-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
HOSTS:
ubuntu-20-04:
roles:
- agent
- master
- database
- dashboard
platform: ubuntu-20.04-amd64
image: ubuntu:20.04
hypervisor: docker
docker_cmd: ["/sbin/init"]
docker_preserve_image: true
docker_image_commands:
- apt-get update
- apt-get install -yq libssl-dev apt-transport-https openjdk-8-jdk iproute2
CONFIG:
log_level: warn
18 changes: 7 additions & 11 deletions spec/classes/000_elasticsearch_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,13 @@

# Varies depending on distro
it { should contain_augeas("#{defaults_path}/elasticsearch") }
it do
should contain_file("#{defaults_path}/elasticsearch").with(
:ensure => 'file',
:group => 'elasticsearch',
:owner => 'elasticsearch',
:mode => '0640'
)
end

# Systemd-specific files
if test_pid == true
it { should contain_service('elasticsearch').with(
:ensure => 'running',
:enable => true
) }
it { should contain_file('/usr/lib/tmpfiles.d/elasticsearch.conf') }
end

context 'java installation' do
Expand Down Expand Up @@ -226,8 +217,15 @@
.with(:ensure => 'purged') }
end

it { should contain_service('elasticsearch')
.with(
:ensure => 'stopped',
:enable => 'false'
) }
it { should contain_file('/usr/share/elasticsearch/plugins')
.with(:ensure => 'absent') }
it { should contain_file("#{defaults_path}/elasticsearch")
.with(:ensure => 'absent') }
end

context 'When managing the repository' do
Expand Down Expand Up @@ -335,8 +333,6 @@
.with(:owner => 'myesuser', :group => 'myesgroup') }
it { should contain_file('/var/lib/elasticsearch')
.with(:owner => 'myesuser', :group => 'myesgroup') }
it { should contain_file('/var/run/elasticsearch')
.with(:owner => 'myesuser') if facts[:os]['family'] == 'RedHat' }
end

describe 'setting jvm_options' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/001_hiera_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
context 'config' do
let(:facts) { facts.merge(:scenario => 'singleinstance') }

it { should contain_augeas('init_defaults') }
it { should contain_augeas('/etc/sysconfig/elasticsearch') }
it { should contain_file('/etc/elasticsearch/elasticsearch.yml') }
it { should contain_datacat('/etc/elasticsearch/elasticsearch.yml') }
it { should contain_datacat_fragment('main_config') }
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/004_elasticsearch_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class { "elasticsearch":
'Service[elasticsearch]'
)}

include_examples 'class', 'es-plugin', :sysv
include_examples('class')
end

context 'restart_plugin_change set to false (default)' do
Expand All @@ -179,7 +179,7 @@ class { "elasticsearch":
'Service[elasticsearch]'
)}

include_examples 'class', 'es-plugin', :sysv
include_examples('class')
end

context 'restart_plugin_change set to true' do
Expand All @@ -197,7 +197,7 @@ class { "elasticsearch":
'Service[elasticsearch]'
)}

include_examples 'class', 'es-plugin', :sysv
include_examples('class')
end
end

Expand Down Expand Up @@ -294,7 +294,7 @@ class { 'elasticsearch': }
'Class[elasticsearch::config]'
)}

include_examples 'class', :sysv
include_examples('class')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
}
}
}
}
}
42 changes: 42 additions & 0 deletions spec/fixtures/templates/7.x.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"index_patterns": [ "logstash-*" ],
"version": 123,
"settings": {
"index": {
"refresh_interval": "5s",
"analysis": {
"analyzer": {
"default": {
"type": "standard",
"stopwords": "_none_"
}
}
}
}
},
"mappings": {
"dynamic_templates": [
{
"string_fields": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "multi_field",
"fields": {
"{name}": {
"type": "text",
"index": "analyzed",
"omit_norms": true
},
"raw": {
"type ": "text",
"index": "not_analyzed",
"ignore_above": 256
}
}
}
}
}
]
}
}
Loading

0 comments on commit 873058e

Please sign in to comment.