From 1577ec78e1a01202f91fbb86b683c301da0227ef Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 17:13:03 -0800 Subject: [PATCH] Add windows as unsupported --- manifests/setup.pp | 8 ++++++++ spec/acceptance/backup_spec.rb | 2 +- spec/acceptance/concat_spec.rb | 8 ++++---- spec/acceptance/empty_spec.rb | 2 +- spec/acceptance/fragment_source_spec.rb | 2 +- spec/acceptance/newline_spec.rb | 2 +- spec/acceptance/order_spec.rb | 12 ++++++------ spec/acceptance/replace_spec.rb | 4 ++-- spec/acceptance/symbolic_name_spec.rb | 2 +- spec/acceptance/unsupported_spec.rb | 18 ++++++++++++++++++ spec/acceptance/warn_spec.rb | 2 +- spec/spec_helper_acceptance.rb | 2 ++ 12 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 spec/acceptance/unsupported_spec.rb diff --git a/manifests/setup.pp b/manifests/setup.pp index 55d7197..5a985f6 100644 --- a/manifests/setup.pp +++ b/manifests/setup.pp @@ -18,6 +18,14 @@ # It also copies out the concatfragments.sh file to ${concatdir}/bin # class concat::setup { + case $::osfamily { + 'windows': { + fail("Unsupported osfamily: ${osfamily}") + } + default: { + # Should work otherwise + } + } $id = $::id $root_group = $id ? { root => 0, diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index 764bdbb..c09c178 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'concat backup parameter' do +describe 'concat backup parameter', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') context '=> puppet' do before :all do diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index ab6788e..b4f7352 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -12,7 +12,7 @@ else groupname = 'root' end -describe 'basic concat test' do +describe 'basic concat test', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') shared_examples 'successfully_applied' do |pp| @@ -51,7 +51,7 @@ describe 'basic concat test' do it { should be_owned_by username } it { should be_grouped_into groupname } # XXX file be_mode isn't supported on AIX - it("should be mode 644", :unless => fact('osfamily') == "AIX") { + it("should be mode 644", :unless => (fact('osfamily') == "AIX" or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should be_mode 644 } it { should contain '1' } @@ -62,7 +62,7 @@ describe 'basic concat test' do it { should be_owned_by username } it { should be_grouped_into groupname } # XXX file be_mode isn't supported on AIX - it("should be mode 644", :unless => fact('osfamily') == "AIX") { + it("should be mode 644", :unless => (fact('osfamily') == "AIX" or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should be_mode 644 } end @@ -71,7 +71,7 @@ describe 'basic concat test' do it { should be_owned_by username } it { should be_grouped_into groupname } # XXX file be_mode isn't supported on AIX - it("should be mode 644", :unless => fact('osfamily') == "AIX") { + it("should be mode 644", :unless => (fact('osfamily') == "AIX" or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should be_mode 644 } end diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb index ad24415..8eb0a96 100644 --- a/spec/acceptance/empty_spec.rb +++ b/spec/acceptance/empty_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'concat force empty parameter' do +describe 'concat force empty parameter', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') context 'should run successfully' do pp = <<-EOS diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index d2f0c7b..3f6eb49 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -12,7 +12,7 @@ else groupname = 'root' end -describe 'concat::fragment source' do +describe 'concat::fragment source', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') context 'should read file fragments from local system' do before(:all) do diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index a511e3f..fb3f17d 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'concat ensure_newline parameter' do +describe 'concat ensure_newline parameter', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') context '=> false' do pp = <<-EOS diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index 32f85d5..1c79ab4 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'concat order' do +describe 'concat order', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') before(:all) do shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") @@ -35,7 +35,7 @@ describe 'concat order' do describe file("#{basedir}/foo") do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string10\nstring1\nsring2", :unless => fact('osfamily') == 'Solaris') { + it("should contain string10\nstring1\nsring2", :unless => (fact('osfamily') == 'Solaris' or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should contain "string10\nstring1\nsring2" } end @@ -69,14 +69,14 @@ describe 'concat order' do describe file("#{basedir}/foo") do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string1\nstring2\nsring10", :unless => fact('osfamily') == 'Solaris') { + it("should contain string1\nstring2\nsring10", :unless => (fact('osfamily') == 'Solaris' or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should contain "string1\nstring2\nsring10" } end end end # concat order -describe 'concat::fragment order' do +describe 'concat::fragment order', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') before(:all) do shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") @@ -112,7 +112,7 @@ describe 'concat::fragment order' do describe file("#{basedir}/foo") do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string3\nstring2\nsring1", :unless => fact('osfamily') == 'Solaris') { + it("should contain string3\nstring2\nsring1", :unless => (fact('osfamily') == 'Solaris' or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should contain "string3\nstring2\nsring1" } end @@ -147,7 +147,7 @@ describe 'concat::fragment order' do describe file("#{basedir}/foo") do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string1\nstring2\nsring3", :unless => fact('osfamily') == 'Solaris') { + it("should contain string1\nstring2\nsring3", :unless => (fact('osfamily') == 'Solaris' or UNSUPPORTED_PLATFORMS.include?(fact('osfamily')))) { should contain "string1\nstring2\nsring3" } end diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index dfc05fe..e84140f 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'replacement of' do +describe 'replacement of', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') context 'file' do context 'should not succeed' do @@ -118,7 +118,7 @@ describe 'replacement of' do end # XXX specinfra doesn't support be_linked_to on AIX - describe file("#{basedir}/file"), :unless => fact("osfamily") == "AIX" do + describe file("#{basedir}/file"), :unless => (fact("osfamily") == "AIX" or UNSUPPORTED_PLATFORMS.include?(fact('osfamily'))) do it { should be_linked_to "#{basedir}/dangling" } end diff --git a/spec/acceptance/symbolic_name_spec.rb b/spec/acceptance/symbolic_name_spec.rb index 384a821..57a9e95 100644 --- a/spec/acceptance/symbolic_name_spec.rb +++ b/spec/acceptance/symbolic_name_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'symbolic name' do +describe 'symbolic name', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') pp = <<-EOS include concat::setup diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb new file mode 100644 index 0000000..9df7d88 --- /dev/null +++ b/spec/acceptance/unsupported_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper_acceptance' + +describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + basedir = default.tmpdir('concat') + it 'should fail' do + pp = <<-EOS + include concat::setup + concat { '#{basedir}/file': + backup => 'puppet', + } + concat::fragment { 'new file': + target => '#{basedir}/file', + content => 'new contents', + } + EOS + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/unsupported/i) + end +end diff --git a/spec/acceptance/warn_spec.rb b/spec/acceptance/warn_spec.rb index 68758fe..b036884 100644 --- a/spec/acceptance/warn_spec.rb +++ b/spec/acceptance/warn_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'concat warn =>' do +describe 'concat warn =>', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do basedir = default.tmpdir('concat') context 'true should enable default warning message' do pp = <<-EOS diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 35dacd1..c75a7fb 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -17,6 +17,8 @@ unless ENV['RS_PROVISION'] == 'no' end end +UNSUPPORTED_PLATFORMS = ['windows'] + RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))