Skip to content

Commit 19385b1

Browse files
Johan De Witstevenpost
authored andcommitted
Remove version check from provider
There is no difference in handling of the versions, since support for pre-4.4 was dropped.
1 parent 6ea7af6 commit 19385b1

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

lib/puppet/provider/mongodb.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,22 +191,4 @@ def self.mongo_version
191191
def mongo_version
192192
self.class.mongo_version
193193
end
194-
195-
def self.mongo_4?
196-
v = mongo_version
197-
!v[%r{^4\.}].nil?
198-
end
199-
200-
def mongo_4?
201-
self.class.mongo_4?
202-
end
203-
204-
def self.mongo_5?
205-
v = mongo_version
206-
!v[%r{^5\.}].nil?
207-
end
208-
209-
def mongo_5?
210-
self.class.mongo_5?
211-
end
212194
end

spec/unit/puppet/provider/mongodb_spec.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313
end
1414

1515
describe 'mongo version detection' do
16-
v = {
17-
'4.x.x' => { '26' => false, '4' => true, '5' => false },
18-
'5.x.x' => { '26' => false, '4' => false, '5' => true },
19-
'x.x.x' => { '26' => false, '4' => false, '5' => false }
20-
}
16+
v = [
17+
'4.x.x',
18+
'5.x.x',
19+
'x.x.x'
20+
]
2121

22-
v.each do |key, results|
22+
v.each do |key|
2323
it "version detection for [#{key}]" do
2424
allow(provider_class).to receive(:mongo_eval).with('db.version()').and_return(key)
25-
expect(provider_class.mongo_4?).to be results['4']
26-
expect(provider_class.mongo_5?).to be results['5']
2725
end
2826
end
2927
end

0 commit comments

Comments
 (0)