Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to latest os supported repo version #757

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ Default value: `true`
Data type: `String[1]`

The version of the package repo.

Default value: `'5.0'`
If not specified, the module will use the most resent version for your OS distro.

##### <a name="-mongodb--globals--use_enterprise_repo"></a>`use_enterprise_repo`

Expand Down
2 changes: 2 additions & 0 deletions data/Debian-10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
mongodb::globals::repo_version: '6.0'
2 changes: 2 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
mongodb::globals::repo_version: '7.0'
7 changes: 4 additions & 3 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#
# @param repo_version
# The version of the package repo.
# If not specified, the module will use the most resent version for your OS distro.
#
# @param use_enterprise_repo
# When manage_package_repo is set to true, this setting indicates if it will use the Community Edition
Expand All @@ -74,11 +75,11 @@
# This sets the password for the proxyserver, should authentication be required
#
class mongodb::globals (
Optional[String[1]] $version = undef,
Optional[String[1]] $client_version = undef,
String[1] $repo_version,
Boolean $manage_package_repo = true,
String[1] $repo_version = '5.0',
Boolean $use_enterprise_repo = false,
Optional[String[1]] $version = undef,
Optional[String[1]] $client_version = undef,
Optional[String] $repo_location = undef,
Optional[String] $keyring_location = undef,
Optional[String] $repo_proxy = undef,
Expand Down
89 changes: 38 additions & 51 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,47 +266,66 @@
end
end

describe 'with journal: true' do
describe 'with journal' do
let :params do
{
journal: true
}
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(true)
if (facts[:os]['name'] == 'Debian') && (facts[:os]['release']['major'] <= '10')
it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(true)
end
else
it { is_expected.to raise_error(Puppet::Error) }
end
end

describe 'with journal: false' do
describe 'with journal: true and package_ensure < 7.0.0' do
let :params do
{
journal: false
package_ensure: '6.0.0',
journal: true
}
end
let(:pre_condition) do
[
'class{"mongodb::globals":
manage_package_repo => false
}'
]
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(false)
expect(config_data['storage']['journal']['enabled']).to be(true)
end
end

describe 'with journal and package_version < 7.0.0' do
describe 'with journal: false and package_ensure < 7.0.0' do
let :params do
{
package_ensure: '6.0.0',
journal: true
journal: false
}
end
let(:pre_condition) do
[
'class{"mongodb::globals":
manage_package_repo => false
}'
]
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(true)
expect(config_data['storage']['journal']['enabled']).to be(false)
end
end

describe 'with journal and package_version >= 7.0.0' do
describe 'with journal and package_ensure >= 7.0.0' do
let :params do
{
package_ensure: '7.0.0',
Expand All @@ -317,45 +336,17 @@
it { is_expected.to raise_error(Puppet::Error) }
end

describe 'with journal and user defined repo_location without version' do
let :params do
{
journal: true
}
end
let(:pre_condition) do
[
'class mongodb::globals {
$manage_package_repo = true
$version = "5.0"
$edition = "org"
$repo_location = "https://repo.myorg.com/"
}',
'class{"mongodb::globals": }'
]
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(true)
end
end

describe 'with journal and user defined repo_location with version < 7.0' do
describe 'with journal and user defined repo_version with version < 7.0' do
let :params do
{
journal: true
}
end
let(:pre_condition) do
[
'class mongodb::globals {
$manage_package_repo = true
$version = "5.0"
$edition = "org"
$repo_location = "https://repo.myorg.com/6.0/"
}',
'class{"mongodb::globals": }'
'class{"mongodb::globals":
repo_version => "6.0"
}'
]
end

Expand All @@ -365,21 +356,17 @@
end
end

describe 'with journal and user defined repo_location with version >= 7.0' do
describe 'with journal and user defined repo_version with version >= 7.0' do
let :params do
{
journal: true
}
end
let(:pre_condition) do
[
'class mongodb::globals {
$manage_package_repo = true
$version = "5.0"
$edition = "org"
$repo_location = "https://repo.myorg.com/7.0/"
}',
'class{"mongodb::globals": }'
'class{"mongodb::globals":
repo_version => "7.0"
}'
]
end

Expand Down