Merge pull request #372 from enovance/feature/372/sbadia
[specs] Add rspec-puppet code coverage (closes: #372)
This commit is contained in:
commit
409f2e9bab
10
Gemfile
10
Gemfile
@ -1,11 +1,11 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
group :development, :test do
|
gem 'puppetlabs_spec_helper'
|
||||||
gem 'puppetlabs_spec_helper', :require => false
|
gem 'puppet-lint'
|
||||||
gem 'puppet-lint', '~> 0.3.2'
|
|
||||||
end
|
|
||||||
|
|
||||||
gem 'json'
|
gem 'json'
|
||||||
|
gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git'
|
||||||
|
gem 'rake'
|
||||||
|
gem 'puppet-syntax'
|
||||||
|
|
||||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||||
gem 'puppet', puppetversion, :require => false
|
gem 'puppet', puppetversion, :require => false
|
||||||
|
11
Rakefile
11
Rakefile
@ -1,5 +1,6 @@
|
|||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
require 'puppetlabs_spec_helper/rake_tasks'
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
require 'puppet-lint/tasks/puppet-lint'
|
||||||
|
require 'puppet-syntax/tasks/puppet-syntax'
|
||||||
|
|
||||||
PuppetLint.configuration.fail_on_warnings = true
|
PuppetLint.configuration.fail_on_warnings = true
|
||||||
PuppetLint.configuration.send('disable_80chars')
|
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)
|
# For stonith-enabled (it's a string not a bool)
|
||||||
PuppetLint.configuration.send('disable_quoted_booleans')
|
PuppetLint.configuration.send('disable_quoted_booleans')
|
||||||
# Ignore all upstream modules
|
# 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).clear
|
||||||
task :default => [:spec_prep, :spec_standalone, :lint]
|
task :default => [:spec_prep, :spec_standalone, :lint]
|
||||||
|
|
||||||
|
desc 'Run syntax, lint and spec tests'
|
||||||
|
task :test => [:syntax,:lint,:spec]
|
||||||
|
@ -73,7 +73,7 @@ class os_params {
|
|||||||
$swift_zone = {
|
$swift_zone = {
|
||||||
'swiftstore1' => 1,
|
'swiftstore1' => 1,
|
||||||
'swiftstore2' => 2,
|
'swiftstore2' => 2,
|
||||||
'swiftstore3' => 3,
|
'swiftstore3' => 3
|
||||||
}
|
}
|
||||||
|
|
||||||
$galera_master_name = $mgmt_names[0]
|
$galera_master_name = $mgmt_names[0]
|
||||||
@ -83,12 +83,12 @@ class os_params {
|
|||||||
$galera_nextserver = {
|
$galera_nextserver = {
|
||||||
"${galera_master_name}" => $mgmt_internal_ips[0],
|
"${galera_master_name}" => $mgmt_internal_ips[0],
|
||||||
"${mgmt_names[1]}" => $mgmt_internal_ips[1],
|
"${mgmt_names[1]}" => $mgmt_internal_ips[1],
|
||||||
"${mgmt_names[2]}" => $mgmt_internal_ips[2],
|
"${mgmt_names[2]}" => $mgmt_internal_ips[2]
|
||||||
}
|
}
|
||||||
|
|
||||||
$ceph_version = 'cuttlefish'
|
$ceph_version = 'cuttlefish'
|
||||||
|
|
||||||
$ceph_names = ['cephstore1', 'cephstore2', 'cephstore3']
|
$ceph_names = ['cephstore1','cephstore2','cephstore3']
|
||||||
|
|
||||||
$ceph_osd_devices = ['sdb','sdc','sdd']
|
$ceph_osd_devices = ['sdb','sdc','sdd']
|
||||||
|
|
||||||
@ -99,6 +99,8 @@ class os_params {
|
|||||||
|
|
||||||
$args = get_scope_args()
|
$args = get_scope_args()
|
||||||
$schema = {
|
$schema = {
|
||||||
|
'type' => 'map',
|
||||||
|
'mapping' => {
|
||||||
'ntp_servers' => {
|
'ntp_servers' => {
|
||||||
'type' => 'any',
|
'type' => 'any',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
@ -327,7 +329,7 @@ class os_params {
|
|||||||
username => 'rhn',
|
username => 'rhn',
|
||||||
password => 'pass',
|
password => 'pass',
|
||||||
server_url => 'https://rhn.redhat.com/rpc/api',
|
server_url => 'https://rhn.redhat.com/rpc/api',
|
||||||
force => true,
|
force => true
|
||||||
}
|
}
|
||||||
|
|
||||||
# OpenStack Identity
|
# OpenStack Identity
|
||||||
@ -399,7 +401,7 @@ class os_params {
|
|||||||
#FIXME: https://github.com/enovance/puppet-cloud/issues/14
|
#FIXME: https://github.com/enovance/puppet-cloud/issues/14
|
||||||
$rabbit_names = $mgmt_names
|
$rabbit_names = $mgmt_names
|
||||||
$rabbit_host = $mgmt_internal_ips[0]
|
$rabbit_host = $mgmt_internal_ips[0]
|
||||||
$rabbit_hosts = suffix($mgmt_internal_ips, ':5672')
|
$rabbit_hosts = suffix($mgmt_internal_ips,':5672')
|
||||||
$rabbit_password = 'secrete'
|
$rabbit_password = 'secrete'
|
||||||
# Useful when we need a single Rabbit host (like Sensu needs)
|
# Useful when we need a single Rabbit host (like Sensu needs)
|
||||||
$rabbit_main_host = $mgmt_internal_ips[0]
|
$rabbit_main_host = $mgmt_internal_ips[0]
|
||||||
@ -447,8 +449,8 @@ class os_params {
|
|||||||
$spice_port = '6082'
|
$spice_port = '6082'
|
||||||
$nova_rbd_user = 'nova'
|
$nova_rbd_user = 'nova'
|
||||||
$nova_rbd_pool = 'vm'
|
$nova_rbd_pool = 'vm'
|
||||||
$nova_ssh_public_key='ssh-rsa XXX nova@openstack'
|
$nova_ssh_public_key = 'ssh-rsa XXX nova@openstack'
|
||||||
$nova_ssh_private_key='
|
$nova_ssh_private_key = '
|
||||||
-----BEGIN RSA PRIVATE KEY-----
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
XXX
|
XXX
|
||||||
-----END RSA PRIVATE KEY-----
|
-----END RSA PRIVATE KEY-----
|
||||||
|
@ -95,9 +95,7 @@ describe 'cloud' do
|
|||||||
{ :osfamily => 'Solaris' }
|
{ :osfamily => 'Solaris' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should fail' do
|
it { should compile.and_raise_error(/module puppet-cloud only support/) }
|
||||||
expect { subject }.to raise_error(/module puppet-cloud only support/)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -88,7 +88,7 @@ describe 'cloud::network::dhcp' do
|
|||||||
:owner => 'root',
|
:owner => 'root',
|
||||||
:group => '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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
1
spec/classes/coverage_spec.rb
Normal file
1
spec/classes/coverage_spec.rb
Normal file
@ -0,0 +1 @@
|
|||||||
|
at_exit { RSpec::Puppet::Coverage.report! }
|
Loading…
x
Reference in New Issue
Block a user