Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Elasticsearch 7 to test matrix #1088

Merged
merged 9 commits into from
Jul 9, 2020
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
52 changes: 6 additions & 46 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 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove also this file?

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