File: manila_ganesha_spec.rb

package info (click to toggle)
puppet-module-manila 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,852 kB
  • sloc: ruby: 5,060; python: 33; makefile: 10; sh: 10
file content (61 lines) | stat: -rw-r--r-- 2,152 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
59
60
61
require 'spec_helper'

describe 'manila::ganesha' do

  shared_examples_for 'manila::ganesha' do
    context 'with defaults' do
      let :params do
        {}
      end

      it 'set the default values' do
        is_expected.to contain_manila_config('DEFAULT/ganesha_config_dir').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/ganesha_config_path').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/ganesha_service_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/ganesha_db_path').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/ganesha_export_dir').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/ganesha_export_template_dir').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'with specific parameters' do
      let :params do
        {
          :ganesha_config_dir          => '/etc/ganesha',
          :ganesha_config_path         => '/etc/ganesha/ganesha.conf',
          :ganesha_service_name        => 'ganesha.nfsd',
          :ganesha_db_path             => '$state_path/manila-ganesha.db',
          :ganesha_export_dir          => '/etc/ganesha/export.d',
          :ganesha_export_template_dir => '/etc/manila/ganesha-export-templ.d',
        }
      end

      it 'Adds NFS Ganesha options to the share drivers' do
        params.each_pair do |config,value|
          is_expected.to contain_manila_config("DEFAULT/#{config}").with_value(value)
        end
      end
    end
  end

  shared_examples_for 'manila::ganesha on RedHat' do
    it { is_expected.to contain_package('nfs-ganesha').with(
      :name   => 'nfs-ganesha',
      :ensure => 'installed',
    ) }
  end

  on_supported_os({
    :supported_os => OSDefaults.get_supported_os
  }).each do |os,facts|
    context "on #{os}" do
      let (:facts) do
        facts.merge!(OSDefaults.get_facts())
      end
      it_configures 'manila::ganesha'
      if facts[:os]['family'] == 'RedHat'
        it_configures 'manila::ganesha on RedHat'
      end
    end
  end
end