Skip to content

Commit b53553b

Browse files
authored
Merge pull request #30 from GabrielNagy/MODULES-10953/update-metadata
2 parents cfcb6b4 + 5ce76c6 commit b53553b

File tree

9 files changed

+139
-171
lines changed

9 files changed

+139
-171
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151

5252
group :release do
5353
gem "puppet-blacksmith", '~> 3.4', require: false
54-
gem "pdk", platforms: [:ruby]
54+
gem "pdk", '~> 2.0', platforms: [:ruby]
5555
end
5656

5757
puppet_version = ENV['PUPPET_GEM_VERSION']

metadata.json

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,70 +12,40 @@
1212
],
1313
"operatingsystem_support": [
1414
{
15-
"operatingsystem": "CentOS",
16-
"operatingsystemrelease": [
17-
"7"
18-
]
15+
"operatingsystem": "CentOS"
1916
},
2017
{
21-
"operatingsystem": "OracleLinux",
22-
"operatingsystemrelease": [
23-
"7"
24-
]
18+
"operatingsystem": "OracleLinux"
2519
},
2620
{
27-
"operatingsystem": "RedHat",
28-
"operatingsystemrelease": [
29-
"7"
30-
]
21+
"operatingsystem": "RedHat"
3122
},
3223
{
33-
"operatingsystem": "Scientific",
34-
"operatingsystemrelease": [
35-
"7"
36-
]
24+
"operatingsystem": "Scientific"
3725
},
3826
{
39-
"operatingsystem": "Debian",
40-
"operatingsystemrelease": [
41-
"8"
42-
]
27+
"operatingsystem": "Debian"
4328
},
4429
{
45-
"operatingsystem": "Ubuntu",
46-
"operatingsystemrelease": [
47-
"16.04"
48-
]
30+
"operatingsystem": "Ubuntu"
4931
},
5032
{
51-
"operatingsystem": "Fedora",
52-
"operatingsystemrelease": [
53-
"28"
54-
]
33+
"operatingsystem": "Fedora"
5534
},
5635
{
57-
"operatingsystem": "Darwin",
58-
"operatingsystemrelease": [
59-
"16"
60-
]
36+
"operatingsystem": "Darwin"
6137
},
6238
{
63-
"operatingsystem": "SLES",
64-
"operatingsystemrelease": [
65-
"12"
66-
]
39+
"operatingsystem": "SLES"
6740
},
6841
{
69-
"operatingsystem": "Solaris",
70-
"operatingsystemrelease": [
71-
"11"
72-
]
42+
"operatingsystem": "Solaris"
7343
}
7444
],
7545
"requirements": [
7646
{
7747
"name": "puppet",
78-
"version_requirement": ">= 6.0.0 < 7.0.0"
48+
"version_requirement": ">= 6.0.0 < 8.0.0"
7949
}
8050
],
8151
"pdk-version": "1.14.0",

spec/integration/provider/mount_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def create_fake_fstab(initially_contains_entry)
2020
@current_options = 'local'
2121
@current_device = '/dev/disk1s1'
2222
Puppet[:digest_algorithm] = 'md5'
23-
Puppet::Type.type(:mount).defaultprovider.stubs(:default_target).returns(@fake_fstab)
24-
Facter.stubs(:value).with(:hostname).returns('some_host')
25-
Facter.stubs(:value).with(:domain).returns('some_domain')
26-
Facter.stubs(:value).with(:kernel).returns('Linux')
27-
Facter.stubs(:value).with(:operatingsystem).returns('RedHat')
28-
Facter.stubs(:value).with(:osfamily).returns('RedHat')
29-
Facter.stubs(:value).with(:fips_enabled).returns(false)
23+
allow(Puppet::Type.type(:mount).defaultprovider).to receive(:default_target).and_return(@fake_fstab)
24+
allow(Facter).to receive(:value).with(:hostname).and_return('some_host')
25+
allow(Facter).to receive(:value).with(:domain).and_return('some_domain')
26+
allow(Facter).to receive(:value).with(:kernel).and_return('Linux')
27+
allow(Facter).to receive(:value).with(:operatingsystem).and_return('RedHat')
28+
allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat')
29+
allow(Facter).to receive(:value).with(:fips_enabled).and_return(false)
3030
Puppet::Util::ExecutionStub.set do |command, _options|
3131
case command[0]
3232
when %r{/s?bin/mount}
@@ -75,8 +75,8 @@ def check_fstab(expected_to_be_present)
7575
def run_in_catalog(settings)
7676
resource = Puppet::Type.type(:mount).new(settings.merge(name: '/Volumes/foo_disk',
7777
device: '/dev/disk1s1', fstype: 'msdos'))
78-
Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # Don't backup to the filebucket
79-
resource.expects(:err).never
78+
allow_any_instance_of(Puppet::FileBucket::Dipper).to receive(:backup) # Don't backup to the filebucket
79+
expect(resource).not_to receive(:err)
8080
catalog = Puppet::Resource::Catalog.new
8181
catalog.host_config = false # Stop Puppet from doing a bunch of magic
8282
catalog.add_resource resource
@@ -112,7 +112,7 @@ def run_in_catalog(settings)
112112
describe "When setting options => '#{options_setting}'" do
113113
it "should leave the system in the #{expected_final_state ? 'mounted' : 'unmounted'} state, #{expected_fstab_data ? 'with' : 'without'} data in /etc/fstab" do
114114
if family == 'Solaris'
115-
skip('Solaris: The mock :operatingsystem value does not get changed in lib/puppet/provider/mount/parsed.rb')
115+
skip('Solaris: The double :operatingsystem value does not get changed in lib/puppet/provider/mount/parsed.rb')
116116
elsif options_setting && options_setting.empty?
117117
expect { run_in_catalog(ensure: ensure_setting, options: options_setting) }.to raise_error Puppet::ResourceError
118118
else

spec/lib/puppet_spec/files.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module PuppetSpec::Files
1010
def self.cleanup
1111
until @global_tempfiles.empty?
1212
path = @global_tempfiles.pop
13-
Dir.unstub(:entries)
1413
FileUtils.rm_rf path, secure: true
1514
end
1615
end

spec/shared_behaviours/all_parsedfile_providers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
files.flatten.each do |file|
77
it "should rewrite #{file} reasonably unchanged" do
8-
provider.stubs(:default_target).returns(file)
8+
allow(provider).to receive(:default_target).and_return(file)
99
provider.prefetch
1010

1111
text = provider.to_file(provider.target_records(file))

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
end
3232

3333
RSpec.configure do |c|
34+
c.mock_with :rspec
3435
c.default_facts = default_facts
3536
c.before :each do
3637
# set to strictest setting for testing

spec/unit/provider/mount/parsed_spec.rb

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"/dev/vg00/lv01\t/spare \t \t ext3 defaults\t1 2"
2020
end
2121

22-
# LAK:FIXME I can't mock Facter because this test happens at parse-time.
22+
# LAK:FIXME I can't double Facter because this test happens at parse-time.
2323
it 'defaults to /etc/vfstab on Solaris' do
2424
if Facter.value(:osfamily) != 'Solaris'
2525
skip('This test only works on Solaris')
@@ -112,8 +112,8 @@
112112

113113
describe 'mountinstances' do
114114
it 'gets name from mountoutput found on Solaris' do
115-
Facter.stubs(:value).with(:osfamily).returns 'Solaris'
116-
described_class.stubs(:mountcmd).returns(File.read(my_fixture('solaris.mount')))
115+
allow(Facter).to receive(:value).with(:osfamily).and_return 'Solaris'
116+
allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('solaris.mount')))
117117
mounts = described_class.mountinstances
118118
expect(mounts.size).to eq(6)
119119
expect(mounts[0]).to eq(name: '/', mounted: :yes)
@@ -125,8 +125,8 @@
125125
end
126126

127127
it 'gets name from mountoutput found on HP-UX' do
128-
Facter.stubs(:value).with(:osfamily).returns 'HP-UX'
129-
described_class.stubs(:mountcmd).returns(File.read(my_fixture('hpux.mount')))
128+
allow(Facter).to receive(:value).with(:osfamily).and_return 'HP-UX'
129+
allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('hpux.mount')))
130130
mounts = described_class.mountinstances
131131
expect(mounts.size).to eq(17)
132132
expect(mounts[0]).to eq(name: '/', mounted: :yes)
@@ -149,8 +149,8 @@
149149
end
150150

151151
it 'gets name from mountoutput found on Darwin' do
152-
Facter.stubs(:value).with(:osfamily).returns 'Darwin'
153-
described_class.stubs(:mountcmd).returns(File.read(my_fixture('darwin.mount')))
152+
allow(Facter).to receive(:value).with(:osfamily).and_return 'Darwin'
153+
allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('darwin.mount')))
154154
mounts = described_class.mountinstances
155155
expect(mounts.size).to eq(6)
156156
expect(mounts[0]).to eq(name: '/', mounted: :yes)
@@ -162,8 +162,8 @@
162162
end
163163

164164
it 'gets name from mountoutput found on Linux' do
165-
Facter.stubs(:value).with(:osfamily).returns 'Gentoo'
166-
described_class.stubs(:mountcmd).returns(File.read(my_fixture('linux.mount')))
165+
allow(Facter).to receive(:value).with(:osfamily).and_return 'Gentoo'
166+
allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('linux.mount')))
167167
mounts = described_class.mountinstances
168168
expect(mounts[0]).to eq(name: '/', mounted: :yes)
169169
expect(mounts[1]).to eq(name: '/lib64/rc/init.d', mounted: :yes)
@@ -175,8 +175,8 @@
175175
end
176176

177177
it 'gets name from mountoutput found on AIX' do
178-
Facter.stubs(:value).with(:osfamily).returns 'AIX'
179-
described_class.stubs(:mountcmd).returns(File.read(my_fixture('aix.mount')))
178+
allow(Facter).to receive(:value).with(:osfamily).and_return 'AIX'
179+
allow(described_class).to receive(:mountcmd).and_return(File.read(my_fixture('aix.mount')))
180180
mounts = described_class.mountinstances
181181
expect(mounts[0]).to eq(name: '/', mounted: :yes)
182182
expect(mounts[1]).to eq(name: '/usr', mounted: :yes)
@@ -190,16 +190,16 @@
190190
end
191191

192192
it 'raises an error if a line is not understandable' do
193-
described_class.stubs(:mountcmd).returns('bazinga!')
193+
allow(described_class).to receive(:mountcmd).and_return('bazinga!')
194194
expect { described_class.mountinstances }.to raise_error Puppet::Error, 'Could not understand line bazinga! from mount output'
195195
end
196196
end
197197

198198
it "supports AIX's paragraph based /etc/filesystems" do
199199
pending 'This test only works on AIX' unless Facter.value(:osfamily) == 'AIX'
200-
Facter.stubs(:value).with(:osfamily).returns 'AIX'
201-
described_class.stubs(:default_target).returns my_fixture('aix.filesystems')
202-
described_class.stubs(:mountcmd).returns File.read(my_fixture('aix.mount'))
200+
allow(Facter).to receive(:value).with(:osfamily).and_return 'AIX'
201+
allow(described_class).to receive(:default_target).and_return my_fixture('aix.filesystems')
202+
allow(described_class).to receive(:mountcmd).and_return File.read(my_fixture('aix.mount'))
203203
instances = described_class.instances
204204
expect(instances[0].name).to eq('/')
205205
expect(instances[0].device).to eq('/dev/hd4')
@@ -220,27 +220,27 @@
220220
end
221221

222222
before :each do
223-
Facter.stubs(:value).with(:osfamily).returns platform
223+
allow(Facter).to receive(:value).with(:osfamily).and_return platform
224224
if Facter[:osfamily] == 'Solaris'
225225
platform == 'solaris' ||
226-
skip("We need to stub the operatingsystem fact at load time, but can't")
226+
skip("We need to double the operatingsystem fact at load time, but can't")
227227
else
228228
platform != 'solaris' ||
229-
skip("We need to stub the operatingsystem fact at load time, but can't")
229+
skip("We need to double the operatingsystem fact at load time, but can't")
230230
end
231231

232232
# Stub the mount output to our fixture.
233233
begin
234234
mount = my_fixture(platform + '.mount')
235-
described_class.stubs(:mountcmd).returns File.read(mount)
235+
allow(described_class).to receive(:mountcmd).and_return File.read(mount)
236236
rescue
237237
skip "is #{platform}.mount missing at this point?"
238238
end
239239

240240
# Note: we have to stub default_target before creating resources
241241
# because it is used by Puppet::Type::Mount.new to populate the
242242
# :target property.
243-
described_class.stubs(:default_target).returns fstab
243+
allow(described_class).to receive(:default_target).and_return fstab
244244
end
245245

246246
# Following mountpoint are present in all fstabs/mountoutputs
@@ -274,17 +274,17 @@
274274
end
275275

276276
before :each do
277-
Facter.stubs(:value).with(:kernel).returns 'Linux'
278-
Facter.stubs(:value).with(:operatingsystem).returns 'RedHat'
279-
Facter.stubs(:value).with(:osfamily).returns 'RedHat'
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'
280280
begin
281281
mount = my_fixture('linux.mount')
282-
described_class.stubs(:mountcmd).returns File.read(mount)
282+
allow(described_class).to receive(:mountcmd).and_return File.read(mount)
283283
rescue
284284
skip 'is linux.mount missing at this point?'
285285
end
286286

287-
described_class.stubs(:default_target).returns my_fixture('linux.fstab')
287+
allow(described_class).to receive(:default_target).and_return my_fixture('linux.fstab')
288288
end
289289

290290
describe 'when handling whitespaces in mountpoints' do
@@ -332,29 +332,29 @@
332332

333333
before :each do
334334
[:osfamily, :operatingsystem, :kernel].each do |fact|
335-
Facter.stubs(:value).with(fact).returns platform
335+
allow(Facter).to receive(:value).with(fact).and_return platform
336336
end
337337

338338
if Facter[:osfamily] == 'Solaris'
339339
platform == 'solaris' ||
340-
skip("We need to stub the operatingsystem fact at load time, but can't")
340+
skip("We need to double the operatingsystem fact at load time, but can't")
341341
else
342342
platform != 'solaris' ||
343-
skip("We need to stub the operatingsystem fact at load time, but can't")
343+
skip("We need to double the operatingsystem fact at load time, but can't")
344344
end
345345

346346
# Stub the mount output to our fixture.
347347
begin
348348
mount = my_fixture(platform + '.mount')
349-
described_class.stubs(:mountcmd).returns File.read(mount)
349+
allow(described_class).to receive(:mountcmd).and_return File.read(mount)
350350
rescue
351351
skip "is #{platform}.mount missing at this point?"
352352
end
353353

354354
# Note: we have to stub default_target before creating resources
355355
# because it is used by Puppet::Type::Mount.new to populate the
356356
# :target property.
357-
described_class.stubs(:default_target).returns fstab
357+
allow(described_class).to receive(:default_target).and_return fstab
358358
end
359359

360360
describe 'on other platforms than Solaris', if: Facter.value(:osfamily) != 'Solaris' do

0 commit comments

Comments
 (0)