Merge pull request #372 from enovance/feature/372/sbadia

[specs] Add rspec-puppet code coverage (closes: #372)
This commit is contained in:
Emilien Macchi
2014-03-21 09:02:20 +01:00
6 changed files with 38 additions and 28 deletions

10
Gemfile
View File

@@ -1,11 +1,11 @@
source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', '~> 0.3.2'
end
gem 'puppetlabs_spec_helper'
gem 'puppet-lint'
gem 'json'
gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git'
gem 'rake'
gem 'puppet-syntax'
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false

View File

@@ -1,5 +1,6 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('disable_80chars')
@@ -8,7 +9,15 @@ PuppetLint.configuration.send('disable_class_parameter_defaults')
# For stonith-enabled (it's a string not a bool)
PuppetLint.configuration.send('disable_quoted_booleans')
# Ignore all upstream modules
PuppetLint.configuration.ignore_paths = ['spec/fixtures/modules/**/*.pp','examples/*.pp']
exclude_paths = ['spec/**/*','pkg/**/*','vendor/**/*']
exclude_lint_paths = exclude_paths + ['examples/*.pp']
PuppetLint.configuration.ignore_paths = exclude_lint_paths
PuppetSyntax.exclude_paths = exclude_paths
task(:default).clear
task :default => [:spec_prep, :spec_standalone, :lint]
desc 'Run syntax, lint and spec tests'
task :test => [:syntax,:lint,:spec]

View File

@@ -73,7 +73,7 @@ class os_params {
$swift_zone = {
'swiftstore1' => 1,
'swiftstore2' => 2,
'swiftstore3' => 3,
'swiftstore3' => 3
}
$galera_master_name = $mgmt_names[0]
@@ -83,7 +83,7 @@ class os_params {
$galera_nextserver = {
"${galera_master_name}" => $mgmt_internal_ips[0],
"${mgmt_names[1]}" => $mgmt_internal_ips[1],
"${mgmt_names[2]}" => $mgmt_internal_ips[2],
"${mgmt_names[2]}" => $mgmt_internal_ips[2]
}
$ceph_version = 'cuttlefish'
@@ -99,6 +99,8 @@ class os_params {
$args = get_scope_args()
$schema = {
'type' => 'map',
'mapping' => {
'ntp_servers' => {
'type' => 'any',
'required' => true,
@@ -327,7 +329,7 @@ class os_params {
username => 'rhn',
password => 'pass',
server_url => 'https://rhn.redhat.com/rpc/api',
force => true,
force => true
}
# OpenStack Identity

View File

@@ -95,9 +95,7 @@ describe 'cloud' do
{ :osfamily => 'Solaris' }
end
it 'should fail' do
expect { subject }.to raise_error(/module puppet-cloud only support/)
end
end
it { should compile.and_raise_error(/module puppet-cloud only support/) }
end
end

View File

@@ -88,7 +88,7 @@ describe 'cloud::network::dhcp' do
:owner => 'root',
:group => 'root'
)
verify_contents(subject, '/etc/neutron/dnsmasq-neutron.conf', ["dhcp-option-force=26,1400"])
should contain_file('/etc/neutron/dnsmasq-neutron.conf').with_content(/^dhcp-option-force=26,1400$/)
end
end

View File

@@ -0,0 +1 @@
at_exit { RSpec::Puppet::Coverage.report! }