From 75d0fbe037c313fbeead43af94a99d2651a80ae5 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Fri, 19 Apr 2013 14:34:05 -0700 Subject: [PATCH] enable basic testing adds the first unit test and the required peripheral config files for rspec-puppet. --- .fixtures.yml | 3 +++ .gitignore | 3 +++ Puppetfile | 13 +++++++++++++ Rakefile | 1 + spec/classes/vswitch_ovs_spec.rb | 27 +++++++++++++++++++++++++++ spec/spec_helper.rb | 1 + 6 files changed, 48 insertions(+) create mode 100644 .fixtures.yml create mode 100644 .gitignore create mode 100644 Puppetfile create mode 100644 Rakefile create mode 100644 spec/classes/vswitch_ovs_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..ad2ac7c9 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,3 @@ +fixtures: + symlinks: + "vswitch": "#{source_dir}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d2480afd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.swp +spec/fixtures/modules/* +spec/fixtures/manifests/* diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 00000000..8e5e04d7 --- /dev/null +++ b/Puppetfile @@ -0,0 +1,13 @@ +source :rubygems + +group :development, :test do + gem 'puppetlabs_spec_helper', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..cd3d3799 --- /dev/null +++ b/Rakefile @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/rake_tasks' diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb new file mode 100644 index 00000000..de7e1465 --- /dev/null +++ b/spec/classes/vswitch_ovs_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe 'vswitch::ovs' do + + context 'on redhat with default parameters' do + + let :facts do + {:osfamily => 'Redhat'} + end + + it 'should contain the correct package and service' do + + should contain_service('openvswitch').with( + :ensure => true, + :enable => true, + :name => 'openvswitch' + ) + + should contain_package('openvswitch').with( + :name => 'openvswitch', + :ensure => 'present', + :before => 'Service[openvswitch]' + ) + + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 00000000..2c6f5664 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper'