File: swift_storage_mount_spec.rb

package info (click to toggle)
puppet-module-swift 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,400 kB
  • sloc: ruby: 9,593; python: 38; sh: 10; makefile: 10
file content (68 lines) | stat: -rw-r--r-- 1,610 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'spec_helper'

describe 'swift::storage::mount' do
  let :title do
    'dans_mount_point'
  end

  shared_examples 'swift::storage::mount' do
    describe 'with defaults params' do
      let :params do
        {
          :device => '/dev/sda'
        }
      end

      it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
        :ensure  => 'present',
        :device  => '/dev/sda',
        :fstype  => 'xfs',
        :options => 'noatime,nodiratime,nofail,logbufs=8',
      )}
    end

    describe 'when mounting a loopback device' do
      let :params do
        {
          :device   => '/dev/sda',
          :loopback => true
        }
      end

      it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
        :device  => '/dev/sda',
        :options => 'noatime,nodiratime,nofail,loop,logbufs=8'
      )}
    end

    describe 'when mounting a loopback device on selinux system' do
      let :params do
        {
          :device => '/dev/sda'
        }
      end

      before do
        facts[:os]['selinux']['enabled'] = 'true'
      end

      it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
        :command     => ['restorecon', '/srv/node/dans_mount_point'],
        :path        => ['/usr/sbin', '/sbin'],
        :refreshonly => true
      )}
    end
  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 'swift::storage::mount'
    end
  end
end