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

Assert distribution support #467

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
29 changes: 29 additions & 0 deletions spec/puppet_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
require 'semantic_puppet'

SUPPORTED_PUPPET_VERSIONS = ['7.9.0', '8.0.0'].map { |v| SemanticPuppet::Version.parse(v) }
SUPPORTED_DISTROS = {
'CentOS' => ['8', '9'],
'Debian' => ['11'],
'RedHat' => ['8', '9'],
'Ubuntu' => ['20.04'],
}

describe 'Puppet module' do
Dir.glob(File.join(__dir__, '../_build/modules/*/metadata.json')).each do |filename|
Expand All @@ -14,12 +20,35 @@
version_requirement ||= '>= 0'
SemanticPuppet::VersionRange.parse(version_requirement)
end
let(:operatingsystem_support) { metadata['operatingsystem_support'] }

SUPPORTED_PUPPET_VERSIONS.each do |puppet_version|
it "supports Puppet #{puppet_version}" do
expect(puppet_requirement).to include(puppet_version)
end
end

SUPPORTED_DISTROS.each do |distro, versions|
versions.each do |version|
it "should support #{distro} #{version}" do
if operatingsystem_support.nil?
skip "No OS support listed"
end

distro_versions = operatingsystem_support.find { |os| os['operatingsystem'] == distro }

if distro_versions.nil?
skip "Distribution #{distro} is not supported"
end

unless distro_versions.key?('operatingsystemrelease')
skip "No specific distribution versions listed"
end

expect(distro_versions['operatingsystemrelease']).to include(version)
end
end
end
end
end
end