|
3 | 3 | require 'spec_helper' |
4 | 4 |
|
5 | 5 | describe 'cvmfs::mount' do |
6 | | - let(:pre_condition) do |
7 | | - 'class{"cvmfs": cvmfs_http_proxy => undef}' |
8 | | - end |
9 | 6 | let(:title) { 'files.example.org' } |
10 | 7 |
|
11 | 8 | on_supported_os.each do |os, facts| |
12 | 9 | context "on #{os}" do |
| 10 | + let(:pre_condition) do |
| 11 | + ['class{"cvmfs": cvmfs_http_proxy => undef}'] |
| 12 | + end |
| 13 | + |
13 | 14 | let(:facts) do |
14 | 15 | facts |
15 | 16 | end |
|
22 | 23 | it { is_expected.to compile.with_all_deps } |
23 | 24 |
|
24 | 25 | it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local') } |
25 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with_content("# cvmfs files.example.org.local file installed with puppet.\n# this files overrides and extends the values contained\n# within the files.example.org.conf file.\n\n") } |
26 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without_content(%r{.*CVMFS_MEMCACHE_SIZE.*$}) } |
27 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without_content(%r{.*CVMFS_USE_GEOAPI.*$}) } |
28 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without_content(%r{.*CVMFS_FOLLOW_REDIRECTS.*$}) } |
29 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without_content(%r{.*CVMFS_CLAIM_OWNERSHIP.*$}) } |
30 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without_content(%r{.*CVMFS_REPOSITORY_TAG.*$}) } |
31 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_HTTP_PROXY.*$}) } |
32 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_QUOTA_LIMIT.*$}) } |
33 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_EXTERNAL_FALLBACK_PROXY=.*$}) } |
34 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_EXTERNAL_HTTP_PROXY=.*$}) } |
35 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_EXTERNAL_TIMEOUT=.*$}) } |
36 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_EXTERNAL_TIMEOUT_DIRECT=.*$}) } |
37 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').without('content' => %r{^CVMFS_EXTERNAL_URL=.*$}) } |
| 26 | + |
| 27 | + it { |
| 28 | + is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local'). |
| 29 | + without_content(%r{.*CVMFS_MEMCACHE_SIZE.*$}). |
| 30 | + without_content(%r{.*CVMFS_USE_GEOAPI.*$}). |
| 31 | + without_content(%r{.*CVMFS_FOLLOW_REDIRECTS.*$}). |
| 32 | + without_content(%r{.*CVMFS_CLAIM_OWNERSHIP.*$}). |
| 33 | + without_content(%r{.*CVMFS_REPOSITORY_TAG.*$}). |
| 34 | + without_content(%r{^CVMFS_HTTP_PROXY.*$}). |
| 35 | + without_content(%r{^CVMFS_QUOTA_LIMIT.*$}). |
| 36 | + without_content(%r{^CVMFS_EXTERNAL_FALLBACK_PROXY=.*$}). |
| 37 | + without_content(%r{^CVMFS_EXTERNAL_HTTP_PROXY=.*$}). |
| 38 | + without_content(%r{^CVMFS_EXTERNAL_TIMEOUT=.*$}). |
| 39 | + without_content(%r{^CVMFS_EXTERNAL_TIMEOUT_DIRECT=.*$}). |
| 40 | + without_content(%r{^CVMFS_EXTERNAL_URL=.*$}). |
| 41 | + with_content("# cvmfs files.example.org.local file installed with puppet.\n# this files overrides and extends the values contained\n# within the files.example.org.conf file.\n\n") |
| 42 | + } |
| 43 | + |
| 44 | + it { is_expected.not_to contain_mount('/cvmfs/files.example.org') } |
38 | 45 |
|
39 | 46 | context 'with lots of parameters set' do |
40 | 47 | let(:params) do |
|
56 | 63 | } |
57 | 64 | end |
58 | 65 |
|
59 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_MEMCACHE_SIZE=2000$}) } |
60 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_USE_GEOAPI='yes'$}) } |
61 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_FOLLOW_REDIRECTS='yes'$}) } |
62 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_CLAIM_OWNERSHIP='yes'$}) } |
63 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_REPOSITORY_TAG='testing'$}) } |
64 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_UID_MAP='/etc/cvmfs/config.d/files.example.org.uid_map'$}) } |
65 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_GID_MAP='/etc/cvmfs/config.d/files.example.org.gid_map'$}) } |
66 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_QUOTA_LIMIT='54321'$}) } |
67 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_KEYS_DIR='/etc/cvmfs/keys/example.org'$}) } |
68 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_EXTERNAL_FALLBACK_PROXY='http://external-fallback.example.org:3128'$}) } |
69 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_EXTERNAL_HTTP_PROXY='http://http-proxy.example.org:2138'$}) } |
70 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_EXTERNAL_TIMEOUT='100'$}) } |
71 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_EXTERNAL_TIMEOUT_DIRECT='450'$}) } |
72 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with('content' => %r{^CVMFS_EXTERNAL_URL='http://external-url.example.org:80'$}) } |
73 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.uid_map').with('content' => %r{^123 12$}) } |
74 | | - it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.gid_map').with('content' => %r{^137 42$}) } |
| 66 | + it { |
| 67 | + is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.local').with_content(%r{^CVMFS_MEMCACHE_SIZE=2000$}). |
| 68 | + with_content(%r{^CVMFS_USE_GEOAPI='yes'$}). |
| 69 | + with_content(%r{^CVMFS_FOLLOW_REDIRECTS='yes'$}). |
| 70 | + with_content(%r{^CVMFS_CLAIM_OWNERSHIP='yes'$}). |
| 71 | + with_content(%r{^CVMFS_REPOSITORY_TAG='testing'$}). |
| 72 | + with_content(%r{^CVMFS_UID_MAP='/etc/cvmfs/config.d/files.example.org.uid_map'$}). |
| 73 | + with_content(%r{^CVMFS_GID_MAP='/etc/cvmfs/config.d/files.example.org.gid_map'$}). |
| 74 | + with_content(%r{^CVMFS_QUOTA_LIMIT='54321'$}). |
| 75 | + with_content(%r{^CVMFS_KEYS_DIR='/etc/cvmfs/keys/example.org'$}). |
| 76 | + with_content(%r{^CVMFS_EXTERNAL_FALLBACK_PROXY='http://external-fallback.example.org:3128'$}). |
| 77 | + with_content(%r{^CVMFS_EXTERNAL_HTTP_PROXY='http://http-proxy.example.org:2138'$}). |
| 78 | + with_content(%r{^CVMFS_EXTERNAL_TIMEOUT='100'$}). |
| 79 | + with_content(%r{^CVMFS_EXTERNAL_TIMEOUT_DIRECT='450'$}). |
| 80 | + with_content(%r{^CVMFS_EXTERNAL_URL='http://external-url.example.org:80'$}) |
| 81 | + } |
| 82 | + |
| 83 | + it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.uid_map').with_content(%r{^123 12$}) } |
| 84 | + it { is_expected.to contain_file('/etc/cvmfs/config.d/files.example.org.gid_map').with_content(%r{^137 42$}) } |
| 85 | + end |
| 86 | + end |
| 87 | + |
| 88 | + context 'with mount_method mount set on main class' do |
| 89 | + let(:pre_condition) do |
| 90 | + 'class{"cvmfs": cvmfs_http_proxy => undef, mount_method => "mount"}' |
75 | 91 | end |
| 92 | + |
| 93 | + it { is_expected.to compile.with_all_deps } |
| 94 | + |
| 95 | + it { |
| 96 | + is_expected.to contain_mount('/cvmfs/files.example.org').with( |
| 97 | + options: 'defaults,_netdev,nodev', |
| 98 | + device: 'files.example.org' |
| 99 | + ) |
| 100 | + } |
| 101 | + |
| 102 | + context 'with mount_options set to an array' do |
| 103 | + let(:params) do |
| 104 | + { |
| 105 | + mount_options: %w[one two three], |
| 106 | + } |
| 107 | + end |
| 108 | + |
| 109 | + it { is_expected.to contain_mount('/cvmfs/files.example.org').with_options('one,two,three') } |
| 110 | + end |
| 111 | + |
| 112 | + context 'with mount_options set to a string' do |
| 113 | + let(:params) do |
| 114 | + { |
| 115 | + mount_options: 'four,five,six', |
| 116 | + } |
| 117 | + end |
| 118 | + |
| 119 | + it { is_expected.to contain_mount('/cvmfs/files.example.org').with_options('four,five,six') } |
| 120 | + end |
| 121 | + end |
| 122 | + |
| 123 | + context 'with mount_method mount and a config_repo set on main class' do |
| 124 | + let(:pre_condition) do |
| 125 | + [ |
| 126 | + 'class{"cvmfs": cvmfs_http_proxy => undef, mount_method => "mount", config_repo => "cvmfs-config.example.org"}', |
| 127 | + 'cvmfs::mount{"cvmfs-config.example.org":}', |
| 128 | + ] |
| 129 | + end |
| 130 | + |
| 131 | + it { is_expected.to compile.with_all_deps } |
| 132 | + |
| 133 | + it { |
| 134 | + is_expected.to contain_mount('/cvmfs/files.example.org').with( |
| 135 | + options: 'defaults,_netdev,nodev,x-systemd.requires-mounts-for=/cvmfs/cvmfs-config.example.org', |
| 136 | + device: 'files.example.org' |
| 137 | + ) |
| 138 | + } |
| 139 | + |
| 140 | + it { |
| 141 | + is_expected.to contain_mount('/cvmfs/cvmfs-config.example.org').with( |
| 142 | + options: 'defaults,_netdev,nodev', |
| 143 | + device: 'cvmfs-config.example.org' |
| 144 | + ) |
| 145 | + } |
76 | 146 | end |
77 | 147 | end |
78 | 148 | end |
|
0 commit comments