|
21 | 21 |
|
22 | 22 | # LAK:FIXME I can't double Facter because this test happens at parse-time. |
23 | 23 | it 'defaults to /etc/vfstab on Solaris' do |
24 | | - if Facter.value(:osfamily) != 'Solaris' |
| 24 | + if Facter.value('os.family') != 'Solaris' |
25 | 25 | skip('This test only works on Solaris') |
26 | 26 | else |
27 | 27 | expect(described_class.default_target).to eq('/etc/vfstab') |
28 | 28 | end |
29 | 29 | end |
30 | 30 |
|
31 | 31 | it 'defaults to /etc/filesystems on AIX' do |
32 | | - pending 'This test only works on AIX' unless Facter.value(:osfamily) == 'AIX' |
| 32 | + pending 'This test only works on AIX' unless Facter.value('os.family') == 'AIX' |
33 | 33 | expect(described_class.default_target).to eq('/etc/filesystems') |
34 | 34 | end |
35 | 35 |
|
36 | 36 | it 'defaults to /etc/fstab on anything else' do |
37 | | - if Facter.value(:osfamily) == 'Solaris' |
| 37 | + if Facter.value('os.family') == 'Solaris' |
38 | 38 | skip('This test only does not work on Solaris') |
39 | 39 | else |
40 | 40 | expect(described_class.default_target).to eq('/etc/fstab') |
|
53 | 53 | # it_should_behave_like "all parsedfile providers", |
54 | 54 | # provider_class, my_fixtures('*.fstab') |
55 | 55 |
|
56 | | - describe 'on Solaris', if: Facter.value(:osfamily) == 'Solaris' do |
| 56 | + describe 'on Solaris', if: Facter.value('os.family') == 'Solaris' do |
57 | 57 | it 'extracts device from the first field' do |
58 | 58 | expect(described_class.parse_line(vfstab_sample)[:device]).to eq('/dev/dsk/c0d0s0') |
59 | 59 | end |
|
83 | 83 | end |
84 | 84 | end |
85 | 85 |
|
86 | | - describe 'on other platforms than Solaris', if: Facter.value(:osfamily) != 'Solaris' do |
| 86 | + describe 'on other platforms than Solaris', if: Facter.value('os.family') != 'Solaris' do |
87 | 87 | it 'extracts device from the first field' do |
88 | 88 | expect(described_class.parse_line(fstab_sample)[:device]).to eq('/dev/vg00/lv01') |
89 | 89 | end |
|
112 | 112 |
|
113 | 113 | describe 'mountinstances' do |
114 | 114 | it 'gets name from mountoutput found on Solaris' do |
115 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'Solaris' |
| 115 | + allow(Facter).to receive(:value).with('os.family').and_return 'Solaris' |
116 | 116 | allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('solaris.mount'))) |
117 | 117 | mounts = described_class.mountinstances |
118 | 118 | expect(mounts.size).to eq(6) |
|
125 | 125 | end |
126 | 126 |
|
127 | 127 | it 'gets name from mountoutput found on HP-UX' do |
128 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'HP-UX' |
| 128 | + allow(Facter).to receive(:value).with('os.family').and_return 'HP-UX' |
129 | 129 | allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('hpux.mount'))) |
130 | 130 | mounts = described_class.mountinstances |
131 | 131 | expect(mounts.size).to eq(17) |
|
149 | 149 | end |
150 | 150 |
|
151 | 151 | it 'gets name from mountoutput found on Darwin' do |
152 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'Darwin' |
| 152 | + allow(Facter).to receive(:value).with('os.family').and_return 'Darwin' |
153 | 153 | allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('darwin.mount'))) |
154 | 154 | mounts = described_class.mountinstances |
155 | 155 | expect(mounts.size).to eq(6) |
|
162 | 162 | end |
163 | 163 |
|
164 | 164 | it 'gets name from mountoutput found on Linux' do |
165 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'Gentoo' |
| 165 | + allow(Facter).to receive(:value).with('os.family').and_return 'Gentoo' |
166 | 166 | allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('linux.mount'))) |
167 | 167 | mounts = described_class.mountinstances |
168 | 168 | expect(mounts[0]).to eq(name: '/', mounted: :yes) |
|
175 | 175 | end |
176 | 176 |
|
177 | 177 | it 'gets name from mountoutput found on AIX' do |
178 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'AIX' |
| 178 | + allow(Facter).to receive(:value).with('os.family').and_return 'AIX' |
179 | 179 | allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('aix.mount'))) |
180 | 180 | mounts = described_class.mountinstances |
181 | 181 | expect(mounts[0]).to eq(name: '/', mounted: :yes) |
|
196 | 196 | end |
197 | 197 |
|
198 | 198 | it "supports AIX's paragraph based /etc/filesystems" do |
199 | | - pending 'This test only works on AIX' unless Facter.value(:osfamily) == 'AIX' |
200 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'AIX' |
| 199 | + pending 'This test only works on AIX' unless Facter.value('os.family') == 'AIX' |
| 200 | + allow(Facter).to receive(:value).with('os.family').and_return 'AIX' |
201 | 201 | allow(described_class).to receive(:default_target).and_return my_fixture('aix.filesystems') |
202 | 202 | allow(described_class).to receive(:mountcmd).and_return File.read(my_fixture('aix.mount')) |
203 | 203 | instances = described_class.instances |
|
220 | 220 | end |
221 | 221 |
|
222 | 222 | before :each do |
223 | | - allow(Facter).to receive(:value).with(:osfamily).and_return platform |
224 | | - if Facter[:osfamily] == 'Solaris' |
| 223 | + allow(Facter).to receive(:value).with('os.family').and_return platform |
| 224 | + if Facter.value('os.family') == 'Solaris' |
225 | 225 | platform == 'solaris' || |
226 | 226 | skip("We need to double the operatingsystem fact at load time, but can't") |
227 | 227 | else |
|
244 | 244 | end |
245 | 245 |
|
246 | 246 | # Following mountpoint are present in all fstabs/mountoutputs |
247 | | - describe 'on other platforms than Solaris', if: Facter.value(:osfamily) != 'Solaris' do |
| 247 | + describe 'on other platforms than Solaris', if: Facter.value('os.family') != 'Solaris' do |
248 | 248 | it 'includes unmounted resources' do |
249 | 249 | expect(instances).to include(name: '/', ensure: :mounted) |
250 | 250 | end |
|
275 | 275 |
|
276 | 276 | before :each do |
277 | 277 | allow(Facter).to receive(:value).with(:kernel).and_return 'Linux' |
278 | | - allow(Facter).to receive(:value).with(:operatingsystem).and_return 'RedHat' |
279 | | - allow(Facter).to receive(:value).with(:osfamily).and_return 'RedHat' |
| 278 | + allow(Facter).to receive(:value).with('os.name').and_return 'RedHat' |
| 279 | + allow(Facter).to receive(:value).with('os.family').and_return 'RedHat' |
280 | 280 | begin |
281 | 281 | mount = my_fixture('linux.mount') |
282 | 282 | allow(described_class).to receive(:mountcmd).and_return File.read(mount) |
|
331 | 331 | end |
332 | 332 |
|
333 | 333 | before :each do |
334 | | - [:osfamily, :operatingsystem, :kernel].each do |fact| |
| 334 | + ['os.family', 'os.name', :kernel].each do |fact| |
335 | 335 | allow(Facter).to receive(:value).with(fact).and_return platform |
336 | 336 | end |
337 | 337 |
|
338 | | - if Facter[:osfamily] == 'Solaris' |
| 338 | + if Facter.value('os.family') == 'Solaris' |
339 | 339 | platform == 'solaris' || |
340 | 340 | skip("We need to double the operatingsystem fact at load time, but can't") |
341 | 341 | else |
|
357 | 357 | allow(described_class).to receive(:default_target).and_return fstab |
358 | 358 | end |
359 | 359 |
|
360 | | - describe 'on other platforms than Solaris', if: Facter.value(:osfamily) != 'Solaris' do |
| 360 | + describe 'on other platforms than Solaris', if: Facter.value('os.family') != 'Solaris' do |
361 | 361 | it 'sets :ensure to :unmounted if found in fstab but not mounted' do |
362 | 362 | described_class.prefetch(resource_hash) |
363 | 363 | expect(res_unmounted.provider.get(:ensure)).to eq(:unmounted) |
|
0 commit comments