File tree Expand file tree Collapse file tree 4 files changed +50
-17
lines changed
Expand file tree Collapse file tree 4 files changed +50
-17
lines changed Original file line number Diff line number Diff line change @@ -2,19 +2,22 @@ source "https://rubygems.org"
22
33group :test do
44 gem "rake"
5- gem "puppet" , ENV [ 'PUPPET_VERSION' ] || '~> 3.4.0'
6- gem "puppet-lint"
5+ gem "puppet" , ENV [ 'PUPPET_VERSION' ] || '~> 3.7.0'
76 gem "rspec-puppet" , :git => 'https://github.com/rodjek/rspec-puppet.git'
8- gem "puppet-syntax"
97 gem "puppetlabs_spec_helper"
8+ gem "metadata-json-lint"
9+ gem "rspec-puppet-facts"
10+ gem "rspec" , "< 3.2.0" , { "platforms" => [ "ruby_18" ] }
1011end
1112
1213group :development do
1314 gem "travis"
1415 gem "travis-lint"
15- gem "beaker"
16- gem "beaker-rspec"
17- gem "vagrant-wrapper"
1816 gem "puppet-blacksmith"
1917 gem "guard-rake"
2018end
19+
20+ group :system_tests do
21+ gem "beaker"
22+ gem "beaker-rspec"
23+ end
Original file line number Diff line number Diff line change @@ -2,13 +2,16 @@ require 'puppetlabs_spec_helper/rake_tasks'
22require 'puppet-lint/tasks/puppet-lint'
33require 'puppet-syntax/tasks/puppet-syntax'
44
5- # These two gems aren't always present, for instance
5+ # These gems aren't always present, for instance
66# on Travis with --without development
77begin
88 require 'puppet_blacksmith/rake_tasks'
99rescue LoadError
1010end
1111
12+ Rake ::Task [ :lint ] . clear
13+
14+ PuppetLint . configuration . relative = true
1215PuppetLint . configuration . send ( "disable_80chars" )
1316PuppetLint . configuration . log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
1417PuppetLint . configuration . fail_on_warnings = true
@@ -20,6 +23,7 @@ PuppetLint.configuration.send('disable_class_parameter_defaults')
2023PuppetLint . configuration . send ( 'disable_class_inherits_from_params_class' )
2124
2225exclude_paths = [
26+ "bundle/**/*" ,
2327 "pkg/**/*" ,
2428 "vendor/**/*" ,
2529 "spec/**/*" ,
@@ -32,9 +36,14 @@ RSpec::Core::RakeTask.new(:acceptance) do |t|
3236 t . pattern = 'spec/acceptance'
3337end
3438
39+ task :metadata do
40+ sh "metadata-json-lint metadata.json"
41+ end
42+
3543desc "Run syntax, lint, and spec tests."
3644task :test => [
3745 :syntax ,
3846 :lint ,
3947 :spec ,
48+ :metadata ,
4049]
Original file line number Diff line number Diff line change 1- # Copyright 2013 Brainsware
1+ # Copyright 2015 any number of authors
22#
33# Licensed under the Apache License, Version 2.0 (the "License");
44# you may not use this file except in compliance with the License.
1515require 'spec_helper'
1616
1717describe 'libvirt' , :type => :class do
18- let ( :title ) { 'libvirt' }
18+ context 'supported operating systems' do
19+ on_supported_os . each do |os , facts |
20+ context "on #{ os } #{ facts } " do
21+ let ( :facts ) do
22+ facts
23+ end
1924
20- it { should contain_class ( 'libvirt' ) }
21- it { should contain_file ( '/etc/libvirt/qemu/networks/autostart/default.xml' )
22- . with_ensure ( 'absent' )
23- }
25+ context 'with default parameters' do
26+ let ( :title ) { 'libvirt' }
2427
25- describe 'with default network enabled' do
26- let ( :params ) { { :defaultnetwork => true } }
28+ it { should contain_class ( 'libvirt' ) }
29+ it { should contain_file ( '/etc/libvirt/qemu/networks/autostart/default.xml' )
30+ . with_ensure ( 'absent' )
31+ }
32+ end
2733
28- it { should contain_class ( 'libvirt' ) }
29- it { should contain_exec ( 'virsh-net-autostart-default' ) }
34+ context 'with default network enabled' do
35+ let ( :params ) { { :defaultnetwork => true } }
36+
37+ it { should contain_class ( 'libvirt' ) }
38+ it { should contain_exec ( 'virsh-net-autostart-default' ) }
39+ end
40+ end
41+ end
3042 end
3143
3244end
Original file line number Diff line number Diff line change 11require 'puppetlabs_spec_helper/module_spec_helper'
2+ require 'rspec-puppet-facts'
3+ include RspecPuppetFacts
4+
5+ RSpec . configure do |c |
6+ c . before do
7+ # avoid "Only root can execute commands as other users"
8+ Puppet . features . stubs ( :root? => true )
9+ end
10+ end
You can’t perform that action at this time.
0 commit comments