-
-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michiel Brandenburg
committed
Sep 30, 2021
1 parent
984ba47
commit 4f02462
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
require 'puppet/provider/mongodb' | ||
|
||
provider_class = Puppet::Provider::Mongodb | ||
describe provider_class do | ||
before do | ||
# Clear the cached version before each test | ||
provider_class.remove_instance_variable(:@mongo_version) \ | ||
if provider_class.instance_variable_defined?(:@mongo_version) | ||
end | ||
|
||
describe 'mongo version detection' do | ||
v = [ | ||
{ :return => '2.6.x', :result => { '26' => true, '4' => false, '5' => false } }, | ||
{ :return => '4.x.x', :result => { '26' => false, '4' => true, '5' => false } }, | ||
{ :return => '5.x.x', :result => { '26' => false, '4' => false, '5' => true } }, | ||
{ :return => 'x.x.x', :result => { '26' => false, '4' => false, '5' => false } } | ||
] | ||
v.each do |version| | ||
it "version detection #{version[:return]}" do | ||
allow(provider_class).to receive(:mongo_eval).with('db.version()').and_return(version[:return]) | ||
expect(provider_class.mongo_26?).to be version[:result]['26'] | ||
expect(provider_class.mongo_4?).to be version[:result]['4'] | ||
expect(provider_class.mongo_5?).to be version[:result]['5'] | ||
end | ||
end | ||
end | ||
end |