File: usergroup_shared_examples.rb

package info (click to toggle)
puppet-module-voxpupuli-elasticsearch 9.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,496 kB
  • sloc: ruby: 9,906; sh: 392; makefile: 4
file content (51 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true

require 'json'
require 'helpers/acceptance/tests/basic_shared_examples'

shared_examples 'user/group acceptance tests' do
  describe 'user/group parameters', first_purge: true, then_purge: true do
    describe 'with non-default values', :with_cleanup do
      let(:extra_manifest) do
        <<-MANIFEST
          group { 'esuser':
            ensure => 'present',
          } -> group { 'esgroup':
            ensure => 'present'
          } -> user { 'esuser':
            ensure => 'present',
            groups => ['esgroup', 'esuser'],
            before => Class['elasticsearch'],
          }
        MANIFEST
      end

      let(:manifest_class_parameters) do
        <<-MANIFEST
          elasticsearch_user => 'esuser',
          elasticsearch_group => 'esgroup',
        MANIFEST
      end

      include_examples(
        'basic acceptance tests',
        'es-01' => {
          'config' => {
            'http.port' => 9200,
            'node.name' => 'elasticsearch001'
          }
        }
      )

      %w[
        /etc/elasticsearch/es-01/elasticsearch.yml
        /usr/share/elasticsearch
        /var/log/elasticsearch
      ].each do |path|
        describe file(path) do
          it { is_expected.to be_owned_by 'esuser' }
        end
      end
    end
  end
end