From 5c378174e37bdb1fae0cbfe8b202efba2383fd84 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Tue, 24 Sep 2013 17:12:27 -0400 Subject: [PATCH 01/34] Ensure that ::setup runs before ::fragment in all cases. --- Gemfile | 1 - manifests/setup.pp | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 783e522..d5738af 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,6 @@ group :development, :test do gem 'serverspec', :require => false gem 'rspec-system-serverspec', :require => false gem 'pry', :require => false - gem 'vagrant-wrapper', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] diff --git a/manifests/setup.pp b/manifests/setup.pp index 2d29bf8..15be696 100644 --- a/manifests/setup.pp +++ b/manifests/setup.pp @@ -52,4 +52,8 @@ class concat::setup { '/usr/local/bin/concatfragments.sh': ensure => absent; } + + # Ensure we run setup first. + Class['concat::setup'] -> Concat::Fragment<| |> + } From 17431c02e735fa158b8518c4e98c177930662754 Mon Sep 17 00:00:00 2001 From: Aaron Blew Date: Fri, 27 Sep 2013 00:24:58 -0700 Subject: [PATCH 02/34] Help message for pluginsync now references the correct section of the config --- README.markdown | 2 +- manifests/setup.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index c9a52b3..9580c9d 100644 --- a/README.markdown +++ b/README.markdown @@ -80,7 +80,7 @@ manifest files. Known Issues: ------------- * Since puppet-concat now relies on a fact for the concat directory, - you will need to set up pluginsync = true on the [master] section of your + you will need to set up pluginsync = true on both the master and client node's '/etc/puppet/puppet.conf' for at least the first run. You have this issue if puppet fails to run on the client and you have a message similar to diff --git a/manifests/setup.pp b/manifests/setup.pp index 15be696..55d7197 100644 --- a/manifests/setup.pp +++ b/manifests/setup.pp @@ -27,7 +27,7 @@ class concat::setup { if $::concat_basedir { $concatdir = $::concat_basedir } else { - fail ("\$concat_basedir not defined. Try running again with pluginsync=true on the [master] section of your node's '/etc/puppet/puppet.conf'.") + fail ("\$concat_basedir not defined. Try running again with pluginsync=true on the [master] and/or [main] section of your node's '/etc/puppet/puppet.conf'.") } $majorversion = regsubst($::puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1') From 9e187ccf36cec6700fcdb700a3a43791707d06a0 Mon Sep 17 00:00:00 2001 From: Paul Chechetin Date: Wed, 16 Oct 2013 13:07:31 +0400 Subject: [PATCH 03/34] Replace LANG => LC_ALL --- files/concatfragments.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/concatfragments.sh b/files/concatfragments.sh index 570d553..88fe0e7 100755 --- a/files/concatfragments.sh +++ b/files/concatfragments.sh @@ -121,7 +121,7 @@ fi IFS_BACKUP=$IFS IFS=' ' -for fragfile in `find fragments/ -type f -follow | LANG=C sort ${SORTARG}` +for fragfile in `find fragments/ -type f -follow | LC_ALL=C sort ${SORTARG}` do cat $fragfile >> "fragments.concat" done From 596cec14be85b8a20fc710980816f696553b2078 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 12 Feb 2014 16:41:41 -0500 Subject: [PATCH 04/34] Port over acceptance tests from master. --- Gemfile | 6 +- Rakefile | 5 +- spec/acceptance/backup_spec.rb | 110 ++++++++ spec/acceptance/basic_spec.rb | 12 + spec/acceptance/concat_spec.rb | 112 ++++++++ spec/acceptance/empty_spec.rb | 24 ++ spec/acceptance/fragment_source_spec.rb | 137 ++++++++++ spec/acceptance/newline_spec.rb | 59 +++++ spec/acceptance/nodesets/centos-59-x64.yml | 10 + spec/acceptance/nodesets/centos-64-x64-pe.yml | 12 + spec/acceptance/nodesets/centos-64-x64.yml | 10 + spec/acceptance/nodesets/debian-607-x64.yml | 10 + spec/acceptance/nodesets/debian-70rc1-x64.yml | 10 + spec/acceptance/nodesets/default.yml | 10 + spec/acceptance/nodesets/fedora-18-x64.yml | 10 + spec/acceptance/nodesets/sles-11sp1-x64.yml | 10 + .../nodesets/ubuntu-server-10044-x64.yml | 10 + .../nodesets/ubuntu-server-12042-x64.yml | 10 + spec/acceptance/order_spec.rb | 141 ++++++++++ spec/acceptance/replace_spec.rb | 247 ++++++++++++++++++ spec/acceptance/symbolic_name_spec.rb | 33 +++ spec/acceptance/warn_spec.rb | 100 +++++++ spec/spec_helper_acceptance.rb | 42 +++ 23 files changed, 1126 insertions(+), 4 deletions(-) create mode 100644 spec/acceptance/backup_spec.rb create mode 100644 spec/acceptance/basic_spec.rb create mode 100644 spec/acceptance/concat_spec.rb create mode 100644 spec/acceptance/empty_spec.rb create mode 100644 spec/acceptance/fragment_source_spec.rb create mode 100644 spec/acceptance/newline_spec.rb create mode 100644 spec/acceptance/nodesets/centos-59-x64.yml create mode 100644 spec/acceptance/nodesets/centos-64-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-64-x64.yml create mode 100644 spec/acceptance/nodesets/debian-607-x64.yml create mode 100644 spec/acceptance/nodesets/debian-70rc1-x64.yml create mode 100644 spec/acceptance/nodesets/default.yml create mode 100644 spec/acceptance/nodesets/fedora-18-x64.yml create mode 100644 spec/acceptance/nodesets/sles-11sp1-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-10044-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-12042-x64.yml create mode 100644 spec/acceptance/order_spec.rb create mode 100644 spec/acceptance/replace_spec.rb create mode 100644 spec/acceptance/symbolic_name_spec.rb create mode 100644 spec/acceptance/warn_spec.rb create mode 100644 spec/spec_helper_acceptance.rb diff --git a/Gemfile b/Gemfile index d5738af..56b9775 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,13 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test do gem 'rake', :require => false gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-system-puppet', :require => false + gem 'beaker', :require => false + gem 'beaker-rspec', :require => false gem 'puppet-lint', :require => false gem 'serverspec', :require => false - gem 'rspec-system-serverspec', :require => false gem 'pry', :require => false end diff --git a/Rakefile b/Rakefile index bb60173..23aea87 100644 --- a/Rakefile +++ b/Rakefile @@ -1,2 +1,5 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'rspec-system/rake_task' +require 'puppet-lint/tasks/puppet-lint' + +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_quoted_booleans') diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb new file mode 100644 index 0000000..98694d1 --- /dev/null +++ b/spec/acceptance/backup_spec.rb @@ -0,0 +1,110 @@ +require 'spec_helper_acceptance' + +describe 'concat backup parameter' do + context '=> puppet' do + before :all do + shell('mkdir -p /tmp/concat') + shell("/bin/echo 'old contents' > /tmp/concat/file") + end + after :all do + shell('rm -rf /tmp/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + backup => 'puppet', + } + concat::fragment { 'new file': + target => '/tmp/concat/file', + content => 'new contents', + } + EOS + + it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stderr).to eq("") + expect(r.stdout).to match(/Filebucketed \/tmp\/concat\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents' + end + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain 'new contents' } + end + end + + context '=> .backup' do + before :all do + shell('mkdir -p /tmp/concat') + shell("/bin/echo 'old contents' > /tmp/concat/file") + end + after :all do + shell('rm -rf /tmp/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + backup => '.backup', + } + concat::fragment { 'new file': + target => '/tmp/concat/file', + content => 'new contents', + } + EOS + + # XXX Puppet doesn't mention anything about filebucketing with a given + # extension like .backup + it 'applies the manifest twice no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain 'new contents' } + end + describe file('/tmp/concat/file.backup') do + it { should be_file } + it { should contain 'old contents' } + end + end + + # XXX The backup parameter uses validate_string() and thus can't be the + # boolean false value, but the string 'false' has the same effect in Puppet 3 + context "=> 'false'" do + before :all do + shell('mkdir -p /tmp/concat') + shell("/bin/echo 'old contents' > /tmp/concat/file") + end + after :all do + shell('rm -rf /tmp/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + backup => '.backup', + } + concat::fragment { 'new file': + target => '/tmp/concat/file', + content => 'new contents', + } + EOS + + it 'applies the manifest twice with no "Filebucketed" stdout and no stderr' do + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stderr).to eq("") + expect(r.stdout).to_not match(/Filebucketed/) + end + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain 'new contents' } + end + end +end diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb new file mode 100644 index 0000000..5d78d7b --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper_acceptance' + +# Here we put the more basic fundamental tests, ultra obvious stuff. +describe "basic tests:" do + it 'copies the module across' do + # No point diagnosing any more if the module wasn't copied properly + shell "ls #{default['distmoduledir']}/concat" do |r| + expect(r.stdout).to match(/Modulefile/) + expect(r.stderr).to be_empty + end + end +end diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb new file mode 100644 index 0000000..a4982c1 --- /dev/null +++ b/spec/acceptance/concat_spec.rb @@ -0,0 +1,112 @@ +require 'spec_helper_acceptance' + +describe 'basic concat test' do + + shared_examples 'successfully_applied' do |pp| + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + end + + context 'owner/group root' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + owner => 'root', + group => 'root', + mode => '0644', + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + order => '02', + } + EOS + + it_behaves_like 'successfully_applied', pp + + describe file('/tmp/concat/file') do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + it { should be_mode 644 } + it { should contain '1' } + it { should contain '2' } + end + describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + it { should be_mode 644 } + end + describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + it { should be_mode 644 } + end + end + + context 'owner/group non-root' do + before(:all) do + shell "groupadd -g 42 bob" + shell "useradd -u 42 -g 42 bob" + end + after(:all) do + shell "userdel bob" + end + + pp=" + concat { '/tmp/concat/file': + owner => 'bob', + group => 'bob', + mode => '0644', + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + order => '02', + } + " + + it_behaves_like 'successfully_applied', pp + + describe file('/tmp/concat/file') do + it { should be_file } + it { should be_owned_by 'bob' } + it { should be_grouped_into 'bob' } + it { should be_mode 644 } + it { should contain '1' } + it { should contain '2' } + end + describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + it { should be_mode 644 } + it { should contain '1' } + end + describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do + it { should be_file } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + it { should be_mode 644 } + it { should contain '2' } + end + end +end diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb new file mode 100644 index 0000000..0999528 --- /dev/null +++ b/spec/acceptance/empty_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper_acceptance' + +describe 'concat force empty parameter' do + context 'should run successfully' do + pp = <<-EOS + concat { '/tmp/concat/file': + owner => root, + group => root, + mode => '0644', + force => true, + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should_not contain '1\n2' } + end + end +end diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb new file mode 100644 index 0000000..6c93f0a --- /dev/null +++ b/spec/acceptance/fragment_source_spec.rb @@ -0,0 +1,137 @@ +require 'spec_helper_acceptance' + +describe 'concat::fragment source' do + context 'should read file fragments from local system' do + before(:all) do + shell("/bin/echo 'file1 contents' > /tmp/concat/file1") + shell("/bin/echo 'file2 contents' > /tmp/concat/file2") + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/foo': } + + concat::fragment { '1': + target => '/tmp/concat/foo', + source => '/tmp/concat/file1', + } + concat::fragment { '2': + target => '/tmp/concat/foo', + content => 'string1 contents', + } + concat::fragment { '3': + target => '/tmp/concat/foo', + source => '/tmp/concat/file2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/foo') do + it { should be_file } + it { should contain 'file1 contents' } + it { should contain 'string1 contents' } + it { should contain 'file2 contents' } + end + end # should read file fragments from local system + + context 'should create files containing first match only.' do + before(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell('mkdir -p /tmp/concat') + shell("/bin/echo 'file1 contents' > /tmp/concat/file1") + shell("/bin/echo 'file2 contents' > /tmp/concat/file2") + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/result_file1': + owner => root, + group => root, + mode => '0644', + } + concat { '/tmp/concat/result_file2': + owner => root, + group => root, + mode => '0644', + } + concat { '/tmp/concat/result_file3': + owner => root, + group => root, + mode => '0644', + } + + concat::fragment { '1': + target => '/tmp/concat/result_file1', + source => [ '/tmp/concat/file1', '/tmp/concat/file2' ], + order => '01', + } + concat::fragment { '2': + target => '/tmp/concat/result_file2', + source => [ '/tmp/concat/file2', '/tmp/concat/file1' ], + order => '01', + } + concat::fragment { '3': + target => '/tmp/concat/result_file3', + source => [ '/tmp/concat/file1', '/tmp/concat/file2' ], + order => '01', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + describe file('/tmp/concat/result_file1') do + it { should be_file } + it { should contain 'file1 contents' } + it { should_not contain 'file2 contents' } + end + describe file('/tmp/concat/result_file2') do + it { should be_file } + it { should contain 'file2 contents' } + it { should_not contain 'file1 contents' } + end + describe file('/tmp/concat/result_file3') do + it { should be_file } + it { should contain 'file1 contents' } + it { should_not contain 'file2 contents' } + end + end + + context 'should fail if no match on source.' do + before(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell('mkdir -p /tmp/concat') + shell('/bin/rm -rf /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/fail_no_source': + owner => root, + group => root, + mode => '0644', + } + + concat::fragment { '1': + target => '/tmp/concat/fail_no_source', + source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ], + order => '01', + } + EOS + + it 'applies the manifest with resource failures' do + apply_manifest(pp, :expect_failures => true) + end + describe file('/tmp/concat/fail_no_source') do + #FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack. + it { should_not be_file } + it { should_not be_directory } + end + end +end + diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb new file mode 100644 index 0000000..996f99e --- /dev/null +++ b/spec/acceptance/newline_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper_acceptance' + +describe 'concat ensure_newline parameter' do + context '=> false' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + ensure_newline => false, + } + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain '12' } + end + end + + context '=> true' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + ensure_newline => true, + } + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :expect_changes => true).stderr).to eq("") + #XXX ensure_newline => true causes changes on every run because the files + #are modified in place. + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain "1\n2\n" } + end + end +end diff --git a/spec/acceptance/nodesets/centos-59-x64.yml b/spec/acceptance/nodesets/centos-59-x64.yml new file mode 100644 index 0000000..2ad90b8 --- /dev/null +++ b/spec/acceptance/nodesets/centos-59-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-59-x64: + roles: + - master + platform: el-5-x86_64 + box : centos-59-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/centos-64-x64-pe.yml b/spec/acceptance/nodesets/centos-64-x64-pe.yml new file mode 100644 index 0000000..7d9242f --- /dev/null +++ b/spec/acceptance/nodesets/centos-64-x64-pe.yml @@ -0,0 +1,12 @@ +HOSTS: + centos-64-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box : centos-64-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: pe diff --git a/spec/acceptance/nodesets/centos-64-x64.yml b/spec/acceptance/nodesets/centos-64-x64.yml new file mode 100644 index 0000000..0639835 --- /dev/null +++ b/spec/acceptance/nodesets/centos-64-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-64-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-64-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/debian-607-x64.yml b/spec/acceptance/nodesets/debian-607-x64.yml new file mode 100644 index 0000000..4c8be42 --- /dev/null +++ b/spec/acceptance/nodesets/debian-607-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + debian-607-x64: + roles: + - master + platform: debian-6-amd64 + box : debian-607-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/debian-70rc1-x64.yml b/spec/acceptance/nodesets/debian-70rc1-x64.yml new file mode 100644 index 0000000..19181c1 --- /dev/null +++ b/spec/acceptance/nodesets/debian-70rc1-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + debian-70rc1-x64: + roles: + - master + platform: debian-7-amd64 + box : debian-70rc1-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..0639835 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-64-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-64-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/fedora-18-x64.yml b/spec/acceptance/nodesets/fedora-18-x64.yml new file mode 100644 index 0000000..624b537 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-18-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + fedora-18-x64: + roles: + - master + platform: fedora-18-x86_64 + box : fedora-18-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/sles-11sp1-x64.yml b/spec/acceptance/nodesets/sles-11sp1-x64.yml new file mode 100644 index 0000000..554c37a --- /dev/null +++ b/spec/acceptance/nodesets/sles-11sp1-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + sles-11sp1-x64: + roles: + - master + platform: sles-11-x86_64 + box : sles-11sp1-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml new file mode 100644 index 0000000..5047017 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-10044-x64: + roles: + - master + platform: ubuntu-10.04-amd64 + box : ubuntu-server-10044-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml new file mode 100644 index 0000000..1c7a34c --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-12042-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box : ubuntu-server-12042-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb new file mode 100644 index 0000000..8a1af6f --- /dev/null +++ b/spec/acceptance/order_spec.rb @@ -0,0 +1,141 @@ +require 'spec_helper_acceptance' + +describe 'concat order' do + before(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell('mkdir -p /tmp/concat') + end + + context '=> alpha' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/foo': + order => 'alpha' + } + concat::fragment { '1': + target => '/tmp/concat/foo', + content => 'string1', + } + concat::fragment { '2': + target => '/tmp/concat/foo', + content => 'string2', + } + concat::fragment { '10': + target => '/tmp/concat/foo', + content => 'string10', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/foo') do + it { should be_file } + it { should contain "string10\nstring1\nsring2" } + end + end + + context '=> numeric' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/foo': + order => 'numeric' + } + concat::fragment { '1': + target => '/tmp/concat/foo', + content => 'string1', + } + concat::fragment { '2': + target => '/tmp/concat/foo', + content => 'string2', + } + concat::fragment { '10': + target => '/tmp/concat/foo', + content => 'string10', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/foo') do + it { should be_file } + it { should contain "string1\nstring2\nsring10" } + end + end +end # concat order + +describe 'concat::fragment order' do + before(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell('mkdir -p /tmp/concat') + end + + context '=> reverse order' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/foo': } + concat::fragment { '1': + target => '/tmp/concat/foo', + content => 'string1', + order => '15', + } + concat::fragment { '2': + target => '/tmp/concat/foo', + content => 'string2', + # default order 10 + } + concat::fragment { '3': + target => '/tmp/concat/foo', + content => 'string3', + order => '1', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/foo') do + it { should be_file } + it { should contain "string3\nstring2\nsring1" } + end + end + + context '=> normal order' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/foo': } + concat::fragment { '1': + target => '/tmp/concat/foo', + content => 'string1', + order => '01', + } + concat::fragment { '2': + target => '/tmp/concat/foo', + content => 'string2', + order => '02' + } + concat::fragment { '3': + target => '/tmp/concat/foo', + content => 'string3', + order => '03', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/foo') do + it { should be_file } + it { should contain "string1\nstring2\nsring3" } + end + end +end # concat::fragment order diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb new file mode 100644 index 0000000..4a305e1 --- /dev/null +++ b/spec/acceptance/replace_spec.rb @@ -0,0 +1,247 @@ +require 'spec_helper_acceptance' + +describe 'replacement of' do + context 'file' do + context 'should not succeed' do + before(:all) do + shell('mkdir -p /tmp/concat') + shell('echo "file exists" > /tmp/concat/file') + end + after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + replace => false, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain 'file exists' } + it { should_not contain '1' } + it { should_not contain '2' } + end + end + + context 'should succeed' do + before(:all) do + shell('mkdir -p /tmp/concat') + shell('echo "file exists" > /tmp/concat/file') + end + after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + replace => true, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should_not contain 'file exists' } + it { should contain '1' } + it { should contain '2' } + end + end + end # file + + context 'symlink' do + context 'should not succeed' do + # XXX the core puppet file type will replace a symlink with a plain file + # when using ensure => present and source => ... but it will not when using + # ensure => present and content => ...; this is somewhat confusing behavior + before(:all) do + shell('mkdir -p /tmp/concat') + shell('ln -s /tmp/concat/dangling /tmp/concat/file') + end + after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + replace => false, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_linked_to '/tmp/concat/dangling' } + end + + describe file('/tmp/concat/dangling') do + # XXX serverspec does not have a matcher for 'exists' + it { should_not be_file } + it { should_not be_directory } + end + end + + context 'should succeed' do + # XXX the core puppet file type will replace a symlink with a plain file + # when using ensure => present and source => ... but it will not when using + # ensure => present and content => ...; this is somewhat confusing behavior + before(:all) do + shell('mkdir -p /tmp/concat') + shell('ln -s /tmp/concat/dangling /tmp/concat/file') + end + after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + replace => true, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain '1' } + it { should contain '2' } + end + end + end # symlink + + context 'directory' do + context 'should not succeed' do + before(:all) do + shell('mkdir -p /tmp/concat/file') + end + after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with stderr for changing to file' do + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/change from directory to file failed/) + expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/change from directory to file failed/) + end + + describe file('/tmp/concat/file') do + it { should be_directory } + end + end + + # XXX concat's force param currently enables the creation of empty files + # when there are no fragments, and the replace param will only replace + # files and symlinks, not directories. The semantics either need to be + # changed, extended, or a new param introduced to control directory + # replacement. + context 'should succeed', :pending => 'not yet implemented' do + before(:all) do + shell('mkdir -p /tmp/concat/file') + end + after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + force => true, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain '1' } + end + end + end # directory +end diff --git a/spec/acceptance/symbolic_name_spec.rb b/spec/acceptance/symbolic_name_spec.rb new file mode 100644 index 0000000..b1b512f --- /dev/null +++ b/spec/acceptance/symbolic_name_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'symbolic name' do + pp = <<-EOS + include concat::setup + concat { 'not_abs_path': + path => '/tmp/concat/file', + } + + concat::fragment { '1': + target => 'not_abs_path', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => 'not_abs_path', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain '1' } + it { should contain '2' } + end +end diff --git a/spec/acceptance/warn_spec.rb b/spec/acceptance/warn_spec.rb new file mode 100644 index 0000000..e19c6b5 --- /dev/null +++ b/spec/acceptance/warn_spec.rb @@ -0,0 +1,100 @@ +require 'spec_helper_acceptance' + +describe 'concat warn =>' do + context 'true should enable default warning message' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + warn => true, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain '# This file is managed by Puppet. DO NOT EDIT.' } + it { should contain '1' } + it { should contain '2' } + end + end + context 'false should not enable default warning message' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + warn => false, + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' } + it { should contain '1' } + it { should contain '2' } + end + end + context '# foo should overide default warning message' do + pp = <<-EOS + include concat::setup + concat { '/tmp/concat/file': + warn => '# foo', + } + + concat::fragment { '1': + target => '/tmp/concat/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '/tmp/concat/file', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end + + describe file('/tmp/concat/file') do + it { should be_file } + it { should contain '# foo' } + it { should contain '1' } + it { should contain '2' } + end + end +end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..b064d68 --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1,42 @@ +require 'beaker-rspec/spec_helper' +require 'beaker-rspec/helpers/serverspec' + +hosts.each do |host| + if host['platform'] =~ /debian/ + on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc' + end + if host.is_pe? + install_pe + else + # Install Puppet + install_package host, 'rubygems' + on host, 'gem install puppet --no-ri --no-rdoc' + on host, "mkdir -p #{host['distmoduledir']}" + end +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + puppet_module_install(:source => proj_root, :module_name => 'concat') + hosts.each do |host| + on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } + end + end + + c.before(:all) do + shell('mkdir -p /tmp/concat') + end + c.after(:all) do + shell('rm -rf /tmp/concat /var/lib/puppet/concat') + end + + c.treat_symbols_as_metadata_keys_with_true_values = true +end From a2bf6e26a1758391215032478eae7b9ad7edf1b6 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 12 Feb 2014 20:01:00 -0500 Subject: [PATCH 05/34] Prepare 1.0.1 release. --- CHANGELOG | 12 ++++++++++++ Modulefile | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index f8141d7..a36cbac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +2014-02-12 1.0.1 + +Summary: + +Minor bugfixes for sorting of fragments and ordering of resources. + +Bugfixes: +- LANG => C replaced with LC_ALL => C to reduce spurious recreation of +fragments. +- Corrected pluginsync documentation. +- Ensure concat::setup always runs before fragments. + 2013-08-09 1.0.0 Summary: diff --git a/Modulefile b/Modulefile index 8515b17..7f223b8 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppetlabs-concat' -version '1.0.0' +version '1.0.1' source 'git://github.com/puppetlabs/puppetlabs-concat.git' author 'Puppetlabs' license 'Apache 2.0' From 1edafdcf42c08e1c434d51c1cdc523fca612e4d3 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 14 Feb 2014 11:15:53 -0800 Subject: [PATCH 06/34] Don't remove /tmp/concat in after :each If the spec files are run in a random order, removing /tmp/concat after certain tests could cause the next tests to fail if they do not recreate this directory. --- spec/acceptance/backup_spec.rb | 12 +++--------- spec/acceptance/basic_spec.rb | 12 ------------ 2 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 spec/acceptance/basic_spec.rb diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index 98694d1..e6bbd17 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -3,12 +3,10 @@ require 'spec_helper_acceptance' describe 'concat backup parameter' do context '=> puppet' do before :all do + shell('rm -rf /tmp/concat') shell('mkdir -p /tmp/concat') shell("/bin/echo 'old contents' > /tmp/concat/file") end - after :all do - shell('rm -rf /tmp/concat') - end pp = <<-EOS include concat::setup @@ -37,12 +35,10 @@ describe 'concat backup parameter' do context '=> .backup' do before :all do + shell('rm -rf /tmp/concat') shell('mkdir -p /tmp/concat') shell("/bin/echo 'old contents' > /tmp/concat/file") end - after :all do - shell('rm -rf /tmp/concat') - end pp = <<-EOS include concat::setup @@ -76,12 +72,10 @@ describe 'concat backup parameter' do # boolean false value, but the string 'false' has the same effect in Puppet 3 context "=> 'false'" do before :all do + shell('rm -rf /tmp/concat') shell('mkdir -p /tmp/concat') shell("/bin/echo 'old contents' > /tmp/concat/file") end - after :all do - shell('rm -rf /tmp/concat') - end pp = <<-EOS include concat::setup diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb deleted file mode 100644 index 5d78d7b..0000000 --- a/spec/acceptance/basic_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper_acceptance' - -# Here we put the more basic fundamental tests, ultra obvious stuff. -describe "basic tests:" do - it 'copies the module across' do - # No point diagnosing any more if the module wasn't copied properly - shell "ls #{default['distmoduledir']}/concat" do |r| - expect(r.stdout).to match(/Modulefile/) - expect(r.stderr).to be_empty - end - end -end From ccf5284b56283148e8b0efbba9fb85c2fcd6ba48 Mon Sep 17 00:00:00 2001 From: Alex Dreyer Date: Fri, 14 Feb 2014 12:54:48 -0800 Subject: [PATCH 07/34] Switch test to use a much higher gid/uid --- spec/acceptance/concat_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index a4982c1..a3c0507 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -57,8 +57,8 @@ describe 'basic concat test' do context 'owner/group non-root' do before(:all) do - shell "groupadd -g 42 bob" - shell "useradd -u 42 -g 42 bob" + shell "groupadd -g 64444 bob" + shell "useradd -u 42 -g 64444 bob" end after(:all) do shell "userdel bob" From e0a7ca97f0e3d8b1196006301d30a19997c8b4c6 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 20 Feb 2014 16:59:08 -0800 Subject: [PATCH 08/34] Fix test port from 596cec1 --- spec/acceptance/newline_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 996f99e..6a761fb 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -46,7 +46,7 @@ describe 'concat ensure_newline parameter' do it 'applies the manifest twice with no stderr' do expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :expect_changes => true).stderr).to eq("") + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") #XXX ensure_newline => true causes changes on every run because the files #are modified in place. end From 600ddf0e43370227a56b39c73492790a6a900342 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 21 Feb 2014 15:35:36 -0800 Subject: [PATCH 09/34] Disable test for unimplemented feature --- spec/acceptance/newline_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 6a761fb..5b7e968 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -46,7 +46,9 @@ describe 'concat ensure_newline parameter' do it 'applies the manifest twice with no stderr' do expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + pending "ensure_newline => true causes changes on every run because the files are modified in place." do + expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + end #XXX ensure_newline => true causes changes on every run because the files #are modified in place. end From 3d625c9c2819f9b3046607d07e2bc6cae53b091d Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sat, 22 Feb 2014 17:15:56 -0800 Subject: [PATCH 10/34] This test is implemented incorrectly, and is testing an unimplemented feature. So commenting it out --- spec/acceptance/newline_spec.rb | 54 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 5b7e968..92a78ad 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -28,34 +28,32 @@ describe 'concat ensure_newline parameter' do end end - context '=> true' do - pp = <<-EOS - include concat::setup - concat { '/tmp/concat/file': - ensure_newline => true, - } - concat::fragment { '1': - target => '/tmp/concat/file', - content => '1', - } - concat::fragment { '2': - target => '/tmp/concat/file', - content => '2', - } - EOS + #context '=> true' do + # pp = <<-EOS + # include concat::setup + # concat { '/tmp/concat/file': + # ensure_newline => true, + # } + # concat::fragment { '1': + # target => '/tmp/concat/file', + # content => '1', + # } + # concat::fragment { '2': + # target => '/tmp/concat/file', + # content => '2', + # } + # EOS - it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - pending "ensure_newline => true causes changes on every run because the files are modified in place." do - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") - end - #XXX ensure_newline => true causes changes on every run because the files - #are modified in place. - end + # it 'applies the manifest twice with no stderr' do + # expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") + # expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + # #XXX ensure_newline => true causes changes on every run because the files + # #are modified in place. + # end - describe file('/tmp/concat/file') do - it { should be_file } - it { should contain "1\n2\n" } - end - end + # describe file('/tmp/concat/file') do + # it { should be_file } + # it { should contain "1\n2\n" } + # end + #end end From 8b852e2b893691fe91eea02d31331e9abdfdd0bd Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 26 Feb 2014 14:17:59 -0800 Subject: [PATCH 11/34] Fix aix/windows ownership issues and vardir path --- spec/acceptance/concat_spec.rb | 102 ++++++++---------------- spec/acceptance/empty_spec.rb | 3 +- spec/acceptance/fragment_source_spec.rb | 28 +++++-- spec/acceptance/replace_spec.rb | 3 +- spec/spec_helper_acceptance.rb | 26 +++--- 5 files changed, 71 insertions(+), 91 deletions(-) diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index a3c0507..673d793 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -1,5 +1,17 @@ require 'spec_helper_acceptance' +case fact('osfamily') +when 'AIX' + username = 'root' + groupname = 'system' +when 'windows' + username = 'Administrator' + groupname = 'Administrators' +else + username = 'root' + groupname = 'root' +end + describe 'basic concat test' do shared_examples 'successfully_applied' do |pp| @@ -9,12 +21,12 @@ describe 'basic concat test' do end end - context 'owner/group root' do + context 'owner/group' do pp = <<-EOS include concat::setup concat { '/tmp/concat/file': - owner => 'root', - group => 'root', + owner => '#{username}', + group => '#{groupname}', mode => '0644', } @@ -35,78 +47,32 @@ describe 'basic concat test' do describe file('/tmp/concat/file') do it { should be_file } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 644 } + 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") { + should be_mode 644 + } it { should contain '1' } it { should contain '2' } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do + describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/01_1") do it { should be_file } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 644 } - end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do - it { should be_file } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 644 } - end - end - - context 'owner/group non-root' do - before(:all) do - shell "groupadd -g 64444 bob" - shell "useradd -u 42 -g 64444 bob" - end - after(:all) do - shell "userdel bob" - end - - pp=" - concat { '/tmp/concat/file': - owner => 'bob', - group => 'bob', - mode => '0644', + 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") { + should be_mode 644 } - - concat::fragment { '1': - target => '/tmp/concat/file', - content => '1', - order => '01', - } - - concat::fragment { '2': - target => '/tmp/concat/file', - content => '2', - order => '02', - } - " - - it_behaves_like 'successfully_applied', pp - - describe file('/tmp/concat/file') do - it { should be_file } - it { should be_owned_by 'bob' } - it { should be_grouped_into 'bob' } - it { should be_mode 644 } - it { should contain '1' } - it { should contain '2' } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do + describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/02_2") do it { should be_file } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 644 } - it { should contain '1' } - end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do - it { should be_file } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 644 } - it { should contain '2' } + 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") { + should be_mode 644 + } end end end diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb index 0999528..f59916d 100644 --- a/spec/acceptance/empty_spec.rb +++ b/spec/acceptance/empty_spec.rb @@ -3,9 +3,8 @@ require 'spec_helper_acceptance' describe 'concat force empty parameter' do context 'should run successfully' do pp = <<-EOS + include concat::setup concat { '/tmp/concat/file': - owner => root, - group => root, mode => '0644', force => true, } diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index 6c93f0a..6d3493b 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -1,5 +1,17 @@ require 'spec_helper_acceptance' +case fact('osfamily') +when 'AIX' + username = 'root' + groupname = 'system' +when 'windows' + username = 'Administrator' + groupname = 'Administrators' +else + username = 'root' + groupname = 'root' +end + describe 'concat::fragment source' do context 'should read file fragments from local system' do before(:all) do @@ -49,18 +61,18 @@ describe 'concat::fragment source' do pp = <<-EOS include concat::setup concat { '/tmp/concat/result_file1': - owner => root, - group => root, + owner => '#{username}', + group => '#{groupname}', mode => '0644', } concat { '/tmp/concat/result_file2': - owner => root, - group => root, + owner => '#{username}', + group => '#{groupname}', mode => '0644', } concat { '/tmp/concat/result_file3': - owner => root, - group => root, + owner => '#{username}', + group => '#{groupname}', mode => '0644', } @@ -112,8 +124,8 @@ describe 'concat::fragment source' do pp = <<-EOS include concat::setup concat { '/tmp/concat/fail_no_source': - owner => root, - group => root, + owner => '#{username}', + group => '#{groupname}', mode => '0644', } diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index 4a305e1..99e9d48 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -116,7 +116,8 @@ describe 'replacement of' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + # XXX specinfra doesn't support be_linked_to on AIX + describe file('/tmp/concat/file'), :unless => fact('osfamily') == "AIX" do it { should be_linked_to '/tmp/concat/dangling' } end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index b064d68..35dacd1 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,17 +1,19 @@ require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' -hosts.each do |host| - if host['platform'] =~ /debian/ - on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc' - end - if host.is_pe? - install_pe - else - # Install Puppet - install_package host, 'rubygems' - on host, 'gem install puppet --no-ri --no-rdoc' - on host, "mkdir -p #{host['distmoduledir']}" +unless ENV['RS_PROVISION'] == 'no' + hosts.each do |host| + if host['platform'] =~ /debian/ + on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc' + end + if host.is_pe? + install_pe + else + # Install Puppet + install_package host, 'rubygems' + on host, 'gem install puppet --no-ri --no-rdoc' + on host, "mkdir -p #{host['distmoduledir']}" + end end end @@ -35,7 +37,7 @@ RSpec.configure do |c| shell('mkdir -p /tmp/concat') end c.after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf /tmp/concat #{default.puppet['vardir']}/concat") end c.treat_symbols_as_metadata_keys_with_true_values = true From 1f61e9d12248edb72443d210b35e1526110e4e20 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 13:01:13 -0800 Subject: [PATCH 12/34] Avoid multi-line greps on solaris 10 --- spec/acceptance/order_spec.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index 8a1af6f..f7f0e2b 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -33,7 +33,10 @@ describe 'concat order' do describe file('/tmp/concat/foo') do it { should be_file } - it { should contain "string10\nstring1\nsring2" } + #XXX Solaris 10 doesn't support multi-line grep + it("should contain string10\nstring1\nsring2", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + should contain "string10\nstring1\nsring2" + } end end @@ -64,7 +67,10 @@ describe 'concat order' do describe file('/tmp/concat/foo') do it { should be_file } - it { should contain "string1\nstring2\nsring10" } + #XXX Solaris 10 doesn't support multi-line grep + it("should contain string1\nstring2\nsring10", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + should contain "string1\nstring2\nsring10" + } end end end # concat order @@ -103,7 +109,10 @@ describe 'concat::fragment order' do describe file('/tmp/concat/foo') do it { should be_file } - it { should contain "string3\nstring2\nsring1" } + #XXX Solaris 10 doesn't support multi-line grep + it("should contain string3\nstring2\nsring1", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + should contain "string3\nstring2\nsring1" + } end end @@ -135,7 +144,10 @@ describe 'concat::fragment order' do describe file('/tmp/concat/foo') do it { should be_file } - it { should contain "string1\nstring2\nsring3" } + #XXX Solaris 10 doesn't support multi-line grep + it("should contain string1\nstring2\nsring3", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + should contain "string1\nstring2\nsring3" + } end end end # concat::fragment order From f37805060f2213ad130cca01f394997dc351f578 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 13:18:29 -0800 Subject: [PATCH 13/34] Correct syntax --- spec/acceptance/order_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index f7f0e2b..ee675a7 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -34,7 +34,7 @@ describe 'concat order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string10\nstring1\nsring2", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + it("should contain string10\nstring1\nsring2", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { should contain "string10\nstring1\nsring2" } end @@ -68,7 +68,7 @@ describe 'concat order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string1\nstring2\nsring10", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + it("should contain string1\nstring2\nsring10", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { should contain "string1\nstring2\nsring10" } end @@ -110,7 +110,7 @@ describe 'concat::fragment order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string3\nstring2\nsring1", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + it("should contain string3\nstring2\nsring1", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { should contain "string3\nstring2\nsring1" } end @@ -145,7 +145,7 @@ describe 'concat::fragment order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string1\nstring2\nsring3", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/) { + it("should contain string1\nstring2\nsring3", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { should contain "string1\nstring2\nsring3" } end From 311adee522b23478b49bb3119867d09ec227c7ea Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 14:20:42 -0800 Subject: [PATCH 14/34] It is actually all Solaris --- spec/acceptance/order_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index ee675a7..e148808 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -34,7 +34,7 @@ describe 'concat order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string10\nstring1\nsring2", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { + it("should contain string10\nstring1\nsring2", :unless => fact('osfamily') == 'Solaris') { should contain "string10\nstring1\nsring2" } end @@ -68,7 +68,7 @@ describe 'concat order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string1\nstring2\nsring10", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { + it("should contain string1\nstring2\nsring10", :unless => fact('osfamily') == 'Solaris') { should contain "string1\nstring2\nsring10" } end @@ -110,7 +110,7 @@ describe 'concat::fragment order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string3\nstring2\nsring1", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { + it("should contain string3\nstring2\nsring1", :unless => fact('osfamily') == 'Solaris') { should contain "string3\nstring2\nsring1" } end @@ -145,7 +145,7 @@ describe 'concat::fragment order' do describe file('/tmp/concat/foo') do it { should be_file } #XXX Solaris 10 doesn't support multi-line grep - it("should contain string1\nstring2\nsring3", :unless => fact('operatingsystemrelease').match(/^10_u\d+$/)) { + it("should contain string1\nstring2\nsring3", :unless => fact('osfamily') == 'Solaris') { should contain "string1\nstring2\nsring3" } end From f0b6187f76d62fbb8aeb3fe9178a9189a97c23aa Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 14:52:53 -0800 Subject: [PATCH 15/34] Use tmpdir instead of /tmp for windows compatability --- spec/acceptance/backup_spec.rb | 43 ++++++------ spec/acceptance/concat_spec.rb | 15 +++-- spec/acceptance/empty_spec.rb | 7 +- spec/acceptance/fragment_source_spec.rb | 67 ++++++++++--------- spec/acceptance/newline_spec.rb | 19 +++--- spec/acceptance/order_spec.rb | 54 ++++++++------- spec/acceptance/replace_spec.rb | 87 +++++++++++++------------ spec/acceptance/symbolic_name_spec.rb | 7 +- spec/acceptance/warn_spec.rb | 27 ++++---- 9 files changed, 178 insertions(+), 148 deletions(-) diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index e6bbd17..f021a55 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -1,20 +1,23 @@ require 'spec_helper_acceptance' describe 'concat backup parameter' do + let :basedir do + default.tmpdir('concat') + end context '=> puppet' do before :all do - shell('rm -rf /tmp/concat') - shell('mkdir -p /tmp/concat') - shell("/bin/echo 'old contents' > /tmp/concat/file") + shell("rm -rf #{basedir}") + shell("mkdir -p #{basedir}") + shell("echo 'old contents' > #{basedir}/file") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': backup => 'puppet', } concat::fragment { 'new file': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'new contents', } EOS @@ -22,12 +25,12 @@ describe 'concat backup parameter' do it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).to eq("") - expect(r.stdout).to match(/Filebucketed \/tmp\/concat\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents' + expect(r.stdout).to match(/Filebucketed #{basedir}\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents' end expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'new contents' } end @@ -35,18 +38,18 @@ describe 'concat backup parameter' do context '=> .backup' do before :all do - shell('rm -rf /tmp/concat') - shell('mkdir -p /tmp/concat') - shell("/bin/echo 'old contents' > /tmp/concat/file") + shell("rm -rf #{basedir}") + shell("mkdir -p #{basedir}") + shell("echo 'old contents' > #{basedir}/file") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': backup => '.backup', } concat::fragment { 'new file': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'new contents', } EOS @@ -58,11 +61,11 @@ describe 'concat backup parameter' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'new contents' } end - describe file('/tmp/concat/file.backup') do + describe file("#{basedir}/file.backup") do it { should be_file } it { should contain 'old contents' } end @@ -72,18 +75,18 @@ describe 'concat backup parameter' do # boolean false value, but the string 'false' has the same effect in Puppet 3 context "=> 'false'" do before :all do - shell('rm -rf /tmp/concat') - shell('mkdir -p /tmp/concat') - shell("/bin/echo 'old contents' > /tmp/concat/file") + shell("rm -rf #{basedir}") + shell("mkdir -p #{basedir}") + shell("echo 'old contents' > #{basedir}/file") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': backup => '.backup', } concat::fragment { 'new file': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => 'new contents', } EOS @@ -96,7 +99,7 @@ describe 'concat backup parameter' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'new contents' } end diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 673d793..4480cb5 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -13,6 +13,9 @@ else end describe 'basic concat test' do + let :basedir do + default.tmpdir('concat') + end shared_examples 'successfully_applied' do |pp| it 'applies the manifest twice with no stderr' do @@ -24,20 +27,20 @@ describe 'basic concat test' do context 'owner/group' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', order => '01', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', order => '02', } @@ -45,7 +48,7 @@ describe 'basic concat test' do it_behaves_like 'successfully_applied', pp - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -56,7 +59,7 @@ describe 'basic concat test' do it { should contain '1' } it { should contain '2' } end - describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/01_1") do + describe file("#{default.puppet['vardir']}/concat/#{basedir.gsub('/','_')}_file/fragments/01_1") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -65,7 +68,7 @@ describe 'basic concat test' do should be_mode 644 } end - describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/02_2") do + describe file("#{default.puppet['vardir']}/concat/#{basedir.gsub('/','_')}_file/fragments/02_2") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb index f59916d..57970dd 100644 --- a/spec/acceptance/empty_spec.rb +++ b/spec/acceptance/empty_spec.rb @@ -1,10 +1,13 @@ require 'spec_helper_acceptance' describe 'concat force empty parameter' do + let :basedir do + default.tmpdir('concat') + end context 'should run successfully' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': mode => '0644', force => true, } @@ -15,7 +18,7 @@ describe 'concat force empty parameter' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should_not contain '1\n2' } end diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index 6d3493b..0ec6d49 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -13,27 +13,30 @@ else end describe 'concat::fragment source' do + let :basedir do + default.tmpdir('concat') + end context 'should read file fragments from local system' do before(:all) do - shell("/bin/echo 'file1 contents' > /tmp/concat/file1") - shell("/bin/echo 'file2 contents' > /tmp/concat/file2") + shell("/bin/echo 'file1 contents' > #{basedir}/file1") + shell("/bin/echo 'file2 contents' > #{basedir}/file2") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', - source => '/tmp/concat/file1', + target => '#{basedir}/foo', + source => '#{basedir}/file1', } concat::fragment { '2': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string1 contents', } concat::fragment { '3': - target => '/tmp/concat/foo', - source => '/tmp/concat/file2', + target => '#{basedir}/foo', + source => '#{basedir}/file2', } EOS @@ -42,7 +45,7 @@ describe 'concat::fragment source' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/foo') do + describe file("#{basedir}/foo") do it { should be_file } it { should contain 'file1 contents' } it { should contain 'string1 contents' } @@ -52,43 +55,43 @@ describe 'concat::fragment source' do context 'should create files containing first match only.' do before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir -p /tmp/concat') - shell("/bin/echo 'file1 contents' > /tmp/concat/file1") - shell("/bin/echo 'file2 contents' > /tmp/concat/file2") + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") + shell("mkdir -p #{basedir}") + shell("echo 'file1 contents' > #{basedir}/file1") + shell("echo 'file2 contents' > #{basedir}/file2") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/result_file1': + concat { '#{basedir}/result_file1': owner => '#{username}', group => '#{groupname}', mode => '0644', } - concat { '/tmp/concat/result_file2': + concat { '#{basedir}/result_file2': owner => '#{username}', group => '#{groupname}', mode => '0644', } - concat { '/tmp/concat/result_file3': + concat { '#{basedir}/result_file3': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat::fragment { '1': - target => '/tmp/concat/result_file1', - source => [ '/tmp/concat/file1', '/tmp/concat/file2' ], + target => '#{basedir}/result_file1', + source => [ '#{basedir}/file1', '#{basedir}/file2' ], order => '01', } concat::fragment { '2': - target => '/tmp/concat/result_file2', - source => [ '/tmp/concat/file2', '/tmp/concat/file1' ], + target => '#{basedir}/result_file2', + source => [ '#{basedir}/file2', '#{basedir}/file1' ], order => '01', } concat::fragment { '3': - target => '/tmp/concat/result_file3', - source => [ '/tmp/concat/file1', '/tmp/concat/file2' ], + target => '#{basedir}/result_file3', + source => [ '#{basedir}/file1', '#{basedir}/file2' ], order => '01', } EOS @@ -97,17 +100,17 @@ describe 'concat::fragment source' do expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/result_file1') do + describe file("#{basedir}/result_file1") do it { should be_file } it { should contain 'file1 contents' } it { should_not contain 'file2 contents' } end - describe file('/tmp/concat/result_file2') do + describe file("#{basedir}/result_file2") do it { should be_file } it { should contain 'file2 contents' } it { should_not contain 'file1 contents' } end - describe file('/tmp/concat/result_file3') do + describe file("#{basedir}/result_file3") do it { should be_file } it { should contain 'file1 contents' } it { should_not contain 'file2 contents' } @@ -116,22 +119,22 @@ describe 'concat::fragment source' do context 'should fail if no match on source.' do before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir -p /tmp/concat') - shell('/bin/rm -rf /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") + shell("mkdir -p #{basedir}") + shell("rm -rf #{basedir}/fail_no_source #{basedir}/nofilehere #{basedir}/nothereeither") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/fail_no_source': + concat { '#{basedir}/fail_no_source': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat::fragment { '1': - target => '/tmp/concat/fail_no_source', - source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ], + target => '#{basedir}/fail_no_source', + source => [ '#{basedir}/nofilehere', '#{basedir}/nothereeither' ], order => '01', } EOS @@ -139,7 +142,7 @@ describe 'concat::fragment source' do it 'applies the manifest with resource failures' do apply_manifest(pp, :expect_failures => true) end - describe file('/tmp/concat/fail_no_source') do + describe file("#{basedir}/fail_no_source") do #FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack. it { should_not be_file } it { should_not be_directory } diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 92a78ad..9ecf26b 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -1,18 +1,21 @@ require 'spec_helper_acceptance' describe 'concat ensure_newline parameter' do + let :basedir do + default.tmpdir('concat') + end context '=> false' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': ensure_newline => false, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -22,7 +25,7 @@ describe 'concat ensure_newline parameter' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '12' } end @@ -31,15 +34,15 @@ describe 'concat ensure_newline parameter' do #context '=> true' do # pp = <<-EOS # include concat::setup - # concat { '/tmp/concat/file': + # concat { '#{basedir}/file': # ensure_newline => true, # } # concat::fragment { '1': - # target => '/tmp/concat/file', + # target => '#{basedir}/file', # content => '1', # } # concat::fragment { '2': - # target => '/tmp/concat/file', + # target => '#{basedir}/file', # content => '2', # } # EOS @@ -51,7 +54,7 @@ describe 'concat ensure_newline parameter' do # #are modified in place. # end - # describe file('/tmp/concat/file') do + # describe file("#{basedir}/file") do # it { should be_file } # it { should contain "1\n2\n" } # end diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index e148808..d01cae2 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -1,27 +1,30 @@ require 'spec_helper_acceptance' describe 'concat order' do + let :basedir do + default.tmpdir('concat') + end before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir -p /tmp/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") + shell("mkdir -p #{basedir}") end context '=> alpha' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/foo': + concat { '#{basedir}/foo': order => 'alpha' } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string1', } concat::fragment { '2': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string2', } concat::fragment { '10': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string10', } EOS @@ -31,7 +34,7 @@ describe 'concat order' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/foo') 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') { @@ -43,19 +46,19 @@ describe 'concat order' do context '=> numeric' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/foo': + concat { '#{basedir}/foo': order => 'numeric' } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string1', } concat::fragment { '2': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string2', } concat::fragment { '10': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string10', } EOS @@ -65,7 +68,7 @@ describe 'concat order' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/foo') 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') { @@ -76,27 +79,30 @@ describe 'concat order' do end # concat order describe 'concat::fragment order' do + let :basedir do + default.tmpdir('concat') + end before(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') - shell('mkdir -p /tmp/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") + shell("mkdir -p #{basedir}") end context '=> reverse order' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string1', order => '15', } concat::fragment { '2': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string2', # default order 10 } concat::fragment { '3': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string3', order => '1', } @@ -107,7 +113,7 @@ describe 'concat::fragment order' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/foo') 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') { @@ -119,19 +125,19 @@ describe 'concat::fragment order' do context '=> normal order' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/foo': } + concat { '#{basedir}/foo': } concat::fragment { '1': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string1', order => '01', } concat::fragment { '2': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string2', order => '02' } concat::fragment { '3': - target => '/tmp/concat/foo', + target => '#{basedir}/foo', content => 'string3', order => '03', } @@ -142,7 +148,7 @@ describe 'concat::fragment order' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/foo') 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') { diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index 99e9d48..1a468b7 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -1,29 +1,32 @@ require 'spec_helper_acceptance' describe 'replacement of' do + let :basedir do + default.tmpdir('concat') + end context 'file' do context 'should not succeed' do before(:all) do - shell('mkdir -p /tmp/concat') - shell('echo "file exists" > /tmp/concat/file') + shell("mkdir -p #{basedir}") + shell('echo "file exists" > #{basedir}/file') end after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': replace => false, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -33,7 +36,7 @@ describe 'replacement of' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain 'file exists' } it { should_not contain '1' } @@ -43,26 +46,26 @@ describe 'replacement of' do context 'should succeed' do before(:all) do - shell('mkdir -p /tmp/concat') - shell('echo "file exists" > /tmp/concat/file') + shell("mkdir -p #{basedir}") + shell("echo "file exists" > #{basedir}/file") end after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': replace => true, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -72,7 +75,7 @@ describe 'replacement of' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should_not contain 'file exists' } it { should contain '1' } @@ -87,26 +90,26 @@ describe 'replacement of' do # when using ensure => present and source => ... but it will not when using # ensure => present and content => ...; this is somewhat confusing behavior before(:all) do - shell('mkdir -p /tmp/concat') - shell('ln -s /tmp/concat/dangling /tmp/concat/file') + shell("mkdir -p #{basedir}") + shell("ln -s #{basedir}/dangling #{basedir}/file") end after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': replace => false, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -117,11 +120,11 @@ describe 'replacement of' do end # XXX specinfra doesn't support be_linked_to on AIX - describe file('/tmp/concat/file'), :unless => fact('osfamily') == "AIX" do - it { should be_linked_to '/tmp/concat/dangling' } + describe file("#{basedir}/file"), :unless => fact("osfamily") == "AIX" do + it { should be_linked_to "#{basedir}/dangling" } end - describe file('/tmp/concat/dangling') do + describe file("#{basedir}/dangling") do # XXX serverspec does not have a matcher for 'exists' it { should_not be_file } it { should_not be_directory } @@ -133,26 +136,26 @@ describe 'replacement of' do # when using ensure => present and source => ... but it will not when using # ensure => present and content => ...; this is somewhat confusing behavior before(:all) do - shell('mkdir -p /tmp/concat') - shell('ln -s /tmp/concat/dangling /tmp/concat/file') + shell("mkdir -p #{basedir}") + shell("ln -s #{basedir}/dangling #{basedir}/file") end after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': replace => true, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -162,7 +165,7 @@ describe 'replacement of' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '1' } it { should contain '2' } @@ -173,23 +176,23 @@ describe 'replacement of' do context 'directory' do context 'should not succeed' do before(:all) do - shell('mkdir -p /tmp/concat/file') + shell("mkdir -p #{basedir}/file") end after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': } + concat { '#{basedir}/file': } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -199,7 +202,7 @@ describe 'replacement of' do expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/change from directory to file failed/) end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_directory } end end @@ -211,25 +214,25 @@ describe 'replacement of' do # replacement. context 'should succeed', :pending => 'not yet implemented' do before(:all) do - shell('mkdir -p /tmp/concat/file') + shell("mkdir -p #{basedir}/file") end after(:all) do - shell('rm -rf /tmp/concat /var/lib/puppet/concat') + shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") end pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': force => true, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', } EOS @@ -239,7 +242,7 @@ describe 'replacement of' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '1' } end diff --git a/spec/acceptance/symbolic_name_spec.rb b/spec/acceptance/symbolic_name_spec.rb index b1b512f..8481768 100644 --- a/spec/acceptance/symbolic_name_spec.rb +++ b/spec/acceptance/symbolic_name_spec.rb @@ -1,10 +1,13 @@ require 'spec_helper_acceptance' describe 'symbolic name' do + let :basedir do + default.tmpdir('concat') + end pp = <<-EOS include concat::setup concat { 'not_abs_path': - path => '/tmp/concat/file', + path => '#{basedir}/file', } concat::fragment { '1': @@ -25,7 +28,7 @@ describe 'symbolic name' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '1' } it { should contain '2' } diff --git a/spec/acceptance/warn_spec.rb b/spec/acceptance/warn_spec.rb index e19c6b5..16947ee 100644 --- a/spec/acceptance/warn_spec.rb +++ b/spec/acceptance/warn_spec.rb @@ -1,21 +1,24 @@ require 'spec_helper_acceptance' describe 'concat warn =>' do + let :basedir do + default.tmpdir('concat') + end context 'true should enable default warning message' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': warn => true, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', order => '01', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', order => '02', } @@ -26,7 +29,7 @@ describe 'concat warn =>' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '# This file is managed by Puppet. DO NOT EDIT.' } it { should contain '1' } @@ -36,18 +39,18 @@ describe 'concat warn =>' do context 'false should not enable default warning message' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': warn => false, } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', order => '01', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', order => '02', } @@ -58,7 +61,7 @@ describe 'concat warn =>' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' } it { should contain '1' } @@ -68,18 +71,18 @@ describe 'concat warn =>' do context '# foo should overide default warning message' do pp = <<-EOS include concat::setup - concat { '/tmp/concat/file': + concat { '#{basedir}/file': warn => '# foo', } concat::fragment { '1': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '1', order => '01', } concat::fragment { '2': - target => '/tmp/concat/file', + target => '#{basedir}/file', content => '2', order => '02', } @@ -90,7 +93,7 @@ describe 'concat warn =>' do expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") end - describe file('/tmp/concat/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain '# foo' } it { should contain '1' } From d887c3b5f546320569f2a525317d7160db7741da Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 15:50:18 -0800 Subject: [PATCH 16/34] Lets can't be used outside of a test context --- spec/acceptance/backup_spec.rb | 4 +--- spec/acceptance/concat_spec.rb | 4 +--- spec/acceptance/empty_spec.rb | 4 +--- spec/acceptance/fragment_source_spec.rb | 4 +--- spec/acceptance/newline_spec.rb | 4 +--- spec/acceptance/order_spec.rb | 8 ++------ spec/acceptance/replace_spec.rb | 4 +--- spec/acceptance/symbolic_name_spec.rb | 4 +--- spec/acceptance/warn_spec.rb | 4 +--- 9 files changed, 10 insertions(+), 30 deletions(-) diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index f021a55..764bdbb 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'concat backup parameter' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') context '=> puppet' do before :all do shell("rm -rf #{basedir}") diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 4480cb5..ab6788e 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -13,9 +13,7 @@ else end describe 'basic concat test' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') shared_examples 'successfully_applied' do |pp| it 'applies the manifest twice with no stderr' do diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb index 57970dd..ad24415 100644 --- a/spec/acceptance/empty_spec.rb +++ b/spec/acceptance/empty_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'concat force empty parameter' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') context 'should run successfully' do pp = <<-EOS include concat::setup diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index 0ec6d49..d2f0c7b 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -13,9 +13,7 @@ else end describe 'concat::fragment source' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') context 'should read file fragments from local system' do before(:all) do shell("/bin/echo 'file1 contents' > #{basedir}/file1") diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 9ecf26b..a511e3f 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'concat ensure_newline parameter' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') context '=> false' do pp = <<-EOS include concat::setup diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index d01cae2..32f85d5 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'concat order' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') before(:all) do shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") shell("mkdir -p #{basedir}") @@ -79,9 +77,7 @@ describe 'concat order' do end # concat order describe 'concat::fragment order' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') before(:all) do shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") shell("mkdir -p #{basedir}") diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index 1a468b7..4893c30 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'replacement of' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') context 'file' do context 'should not succeed' do before(:all) do diff --git a/spec/acceptance/symbolic_name_spec.rb b/spec/acceptance/symbolic_name_spec.rb index 8481768..384a821 100644 --- a/spec/acceptance/symbolic_name_spec.rb +++ b/spec/acceptance/symbolic_name_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'symbolic name' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') pp = <<-EOS include concat::setup concat { 'not_abs_path': diff --git a/spec/acceptance/warn_spec.rb b/spec/acceptance/warn_spec.rb index 16947ee..68758fe 100644 --- a/spec/acceptance/warn_spec.rb +++ b/spec/acceptance/warn_spec.rb @@ -1,9 +1,7 @@ require 'spec_helper_acceptance' describe 'concat warn =>' do - let :basedir do - default.tmpdir('concat') - end + basedir = default.tmpdir('concat') context 'true should enable default warning message' do pp = <<-EOS include concat::setup From 495619794e310543cecf1c7da7aa4117a389a20a Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 16:07:01 -0800 Subject: [PATCH 17/34] Correct the incorrect quotes --- spec/acceptance/replace_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index 4893c30..dfc05fe 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -6,7 +6,7 @@ describe 'replacement of' do context 'should not succeed' do before(:all) do shell("mkdir -p #{basedir}") - shell('echo "file exists" > #{basedir}/file') + shell("echo 'file exists' > #{basedir}/file") end after(:all) do shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") @@ -45,7 +45,7 @@ describe 'replacement of' do context 'should succeed' do before(:all) do shell("mkdir -p #{basedir}") - shell("echo "file exists" > #{basedir}/file") + shell("echo 'file exists' > #{basedir}/file") end after(:all) do shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat") From 1577ec78e1a01202f91fbb86b683c301da0227ef Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 27 Feb 2014 17:13:03 -0800 Subject: [PATCH 18/34] 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__), '..')) From 68a54e45ab4840518a6b48042615860fd48fd45a Mon Sep 17 00:00:00 2001 From: Lauren Rother Date: Sat, 1 Mar 2014 08:25:23 -0800 Subject: [PATCH 19/34] Adds "Release Notes/Known Bugs" to Changelog,updates file format to markdown, standardizes the format of previous entries Per a request to have initial release notes that specifically listed known issues for this PE 3.2 release, and barred by time constraints from automating a pull from open issues in JIRA, this commit adds a Release Note and Known Bug section to the Changelog for the imminent 3.2 release.As it will display on the Forge, updates file type to markdown and standardizes previous entries. Adds template for release notes to be filled in later. --- CHANGELOG => CHANGELOG.md | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) rename CHANGELOG => CHANGELOG.md (93%) diff --git a/CHANGELOG b/CHANGELOG.md similarity index 93% rename from CHANGELOG rename to CHANGELOG.md index a36cbac..32784b1 100644 --- a/CHANGELOG +++ b/CHANGELOG.md @@ -1,32 +1,45 @@ -2014-02-12 1.0.1 +##2014-03-04 - Supported Release 1.0.x +###Summary -Summary: +####Features + +####Bugfixes + +####Known Bugs + +* Not supported on Windows. + + +##2014-02-12 - 1.0.1 + +###Summary Minor bugfixes for sorting of fragments and ordering of resources. -Bugfixes: +####Bugfixes - LANG => C replaced with LC_ALL => C to reduce spurious recreation of fragments. - Corrected pluginsync documentation. - Ensure concat::setup always runs before fragments. -2013-08-09 1.0.0 -Summary: +##2013-08-09 - 1.0.0 + +###Summary Many new features and bugfixes in this release, and if you're a heavy concat user you should test carefully before upgrading. The features should all be backwards compatible but only light testing has been done from our side before this release. -Features: +####Features - New parameters in concat: - `replace`: specify if concat should replace existing files. - `ensure_newline`: controls if fragments should contain a newline at the end. - Improved README documentation. - Add rspec:system tests (rake spec:system to test concat) -Bugfixes +####Bugfixes - Gracefully handle \n in a fragment resource name. - Adding more helpful message for 'pluginsync = true' - Allow passing `source` and `content` directly to file resource, rather than @@ -36,7 +49,7 @@ defining resource defaults. - Allow WARNMSG to contain/start with '#'. - Replace while-read pattern with for-do in order to support Solaris. -CHANGELOG: +####CHANGELOG: - 2010/02/19 - initial release - 2010/03/12 - add support for 0.24.8 and newer - make the location of sort configurable From 9afd286219d096ef20454e69c1d6176e96f35f11 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Fri, 28 Feb 2014 15:47:12 +0000 Subject: [PATCH 20/34] Prepare for supported modules. --- metadata.json | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 metadata.json diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..611c618 --- /dev/null +++ b/metadata.json @@ -0,0 +1,71 @@ +{ + "operatingsystem_support": [ + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "5", + "6" + ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "5", + "6" + ] + }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "5", + "6" + ] + }, + { + "operatingsystem": "Scientific", + "operatingsystemrelease": [ + "5", + "6" + ] + }, + { + "operatingsystem": "SLES", + "operatingsystemrelease": [ + "11 SP1" + ] + }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "10.04", + "12.04" + ] + }, + { + "operatingsystem": "Solaris", + "operatingsystemrelease": [ + "10", + "11" + ] + }, + { + "operatingsystem": "AIX", + "operatingsystemrelease": [ + "5.3", + "6.1", + "7.1" + ] + } + ], + "requirements": [ + { "name": "pe", "version_requirement": "3.2.x" }, + { "name": "puppet", "version_requirement": "3.x" } + ] +} From 62913f72f590d38db1f50e4471ff54672241a51b Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Mon, 3 Mar 2014 19:19:20 +0000 Subject: [PATCH 21/34] Prepare supported module 1.0.2. --- CHANGELOG.md | 6 +++++- Modulefile | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32784b1..ec0a281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ -##2014-03-04 - Supported Release 1.0.x +##2014-03-04 - Supported Release 1.0.2 ###Summary +This is a supported release. No functional changes were made from 1.0.1. + ####Features +- Huge amount of tests backported from 1.1. +- Documentation rewrite. ####Bugfixes diff --git a/Modulefile b/Modulefile index 7f223b8..a1c880e 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppetlabs-concat' -version '1.0.1' +version '1.0.2' source 'git://github.com/puppetlabs/puppetlabs-concat.git' author 'Puppetlabs' license 'Apache 2.0' From b4ba7dde50129eeb547ed6b6ade1d895ead3ec80 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Mon, 3 Mar 2014 21:45:21 +0000 Subject: [PATCH 22/34] Add in missing files to work around Puppet bug. --- metadata.json | 10 +++++++++- spec/fixtures/manifests/site.pp | 0 2 files changed, 9 insertions(+), 1 deletion(-) delete mode 100644 spec/fixtures/manifests/site.pp diff --git a/metadata.json b/metadata.json index 611c618..09d5524 100644 --- a/metadata.json +++ b/metadata.json @@ -1,4 +1,11 @@ { + "name": "puppetlabs-concat", + "version": "1.0.2", + "source": "https://github.com/puppetlabs/puppetlabs-concat", + "author": "Puppet Labs", + "license": "Apache-2.0", + "project_page": "https://github.com/puppetlabs/puppetlabs-concat", + "summary": "Concat module", "operatingsystem_support": [ { "operatingsystem": "RedHat", @@ -67,5 +74,6 @@ "requirements": [ { "name": "pe", "version_requirement": "3.2.x" }, { "name": "puppet", "version_requirement": "3.x" } - ] + ], + "dependencies": [] } diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp deleted file mode 100644 index e69de29..0000000 From 33b90b4fbc165061722477bce956cf0eeb1f9761 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Wed, 14 May 2014 16:10:03 -0400 Subject: [PATCH 23/34] Fixes to get tests running on trusty. --- .../nodesets/ubuntu-server-1404-x64.yml | 11 +++++++++++ spec/spec_helper_acceptance.rb | 16 +++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..cba1cd0 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box : puppetlabs/ubuntu-14.04-64-nocm + box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor : vagrant +CONFIG: + log_level : debug + type: git diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index c75a7fb..e6860c9 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,19 +1,17 @@ require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' -unless ENV['RS_PROVISION'] == 'no' +unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' + if hosts.first.is_pe? + install_pe + else + install_puppet + end hosts.each do |host| if host['platform'] =~ /debian/ on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc' end - if host.is_pe? - install_pe - else - # Install Puppet - install_package host, 'rubygems' - on host, 'gem install puppet --no-ri --no-rdoc' - on host, "mkdir -p #{host['distmoduledir']}" - end + on hosts, "mkdir -p #{host['distmoduledir']}" end end From fc56fe3d7c3dd2bb7ff792fca194b062b1744218 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Wed, 14 May 2014 16:30:29 -0400 Subject: [PATCH 24/34] Update changelog, modulefile and metadata.json for supported 1.0.3 release. --- CHANGELOG.md | 14 ++++++++++++++ Modulefile | 2 +- metadata.json | 18 +++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec0a281..ec049a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## - Supported Release 1.0.3 +###Summary + +This is a supported release. No functional changes were made from 1.0.2. + +####Features +- Added test support for Ubuntu Trusty. + +####Bugfixes + +####Known bugs + +*Not supported on Windows. + ##2014-03-04 - Supported Release 1.0.2 ###Summary diff --git a/Modulefile b/Modulefile index a1c880e..4f8a0aa 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppetlabs-concat' -version '1.0.2' +version '1.0.3' source 'git://github.com/puppetlabs/puppetlabs-concat.git' author 'Puppetlabs' license 'Apache 2.0' diff --git a/metadata.json b/metadata.json index 09d5524..3f84e9b 100644 --- a/metadata.json +++ b/metadata.json @@ -11,28 +11,35 @@ "operatingsystem": "RedHat", "operatingsystemrelease": [ "5", - "6" + "6", + "7" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "5", - "6" + "6", + "7" + ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "5", - "6" + "6", + "7" + ] }, { "operatingsystem": "Scientific", "operatingsystemrelease": [ "5", - "6" + "6", + "7" + ] }, { @@ -52,7 +59,8 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "10.04", - "12.04" + "12.04", + "14.04" ] }, { From 8f5c30c6a31807d385780f6ac83307f76ee92fd1 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Thu, 15 May 2014 14:58:07 -0400 Subject: [PATCH 25/34] Claim PE3.3 support. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 3f84e9b..773c988 100644 --- a/metadata.json +++ b/metadata.json @@ -80,7 +80,7 @@ } ], "requirements": [ - { "name": "pe", "version_requirement": "3.2.x" }, + { "name": "pe", "version_requirement": "3.3.x" }, { "name": "puppet", "version_requirement": "3.x" } ], "dependencies": [] From 43a0313ba97aafeaf6f5e5f58a54587d72610d19 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 20 May 2014 14:03:28 -0400 Subject: [PATCH 26/34] Update version in metadata.json. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 773c988..ea6ca74 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-concat", - "version": "1.0.2", + "version": "1.0.3", "source": "https://github.com/puppetlabs/puppetlabs-concat", "author": "Puppet Labs", "license": "Apache-2.0", From 379e273e2e9b54556a5d6f5331887b76139c8b59 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Wed, 21 May 2014 19:28:25 -0400 Subject: [PATCH 27/34] Update PE version requirement. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index ea6ca74..25f9735 100644 --- a/metadata.json +++ b/metadata.json @@ -80,7 +80,7 @@ } ], "requirements": [ - { "name": "pe", "version_requirement": "3.3.x" }, + { "name": "pe", "version_requirement": ">= 3.2.0 < 3.4.0" }, { "name": "puppet", "version_requirement": "3.x" } ], "dependencies": [] From f66ca3c1b7d67be9143d20d10eed101265bba442 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Mon, 2 Jun 2014 16:10:29 -0400 Subject: [PATCH 28/34] Remove all the eq() checks as this breaks in PE3.3. --- spec/acceptance/backup_spec.rb | 10 ++++---- spec/acceptance/concat_spec.rb | 4 ++-- spec/acceptance/empty_spec.rb | 4 ++-- spec/acceptance/fragment_source_spec.rb | 8 +++---- spec/acceptance/newline_spec.rb | 32 ++----------------------- spec/acceptance/order_spec.rb | 16 ++++++------- spec/acceptance/replace_spec.rb | 20 ++++++++-------- spec/acceptance/symbolic_name_spec.rb | 4 ++-- spec/acceptance/warn_spec.rb | 12 +++++----- 9 files changed, 40 insertions(+), 70 deletions(-) diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index c09c178..efd19a5 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -22,10 +22,9 @@ describe 'concat backup parameter', :unless => UNSUPPORTED_PLATFORMS.include?(fa it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stderr).to eq("") expect(r.stdout).to match(/Filebucketed #{basedir}\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents' end - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -55,8 +54,8 @@ describe 'concat backup parameter', :unless => UNSUPPORTED_PLATFORMS.include?(fa # XXX Puppet doesn't mention anything about filebucketing with a given # extension like .backup it 'applies the manifest twice no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -91,10 +90,9 @@ describe 'concat backup parameter', :unless => UNSUPPORTED_PLATFORMS.include?(fa it 'applies the manifest twice with no "Filebucketed" stdout and no stderr' do apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stderr).to eq("") expect(r.stdout).to_not match(/Filebucketed/) end - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index b4f7352..d2950e7 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -17,8 +17,8 @@ describe 'basic concat test', :unless => UNSUPPORTED_PLATFORMS.include?(fact('os shared_examples 'successfully_applied' do |pp| it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end end diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb index 8eb0a96..21da4a3 100644 --- a/spec/acceptance/empty_spec.rb +++ b/spec/acceptance/empty_spec.rb @@ -12,8 +12,8 @@ describe 'concat force empty parameter', :unless => UNSUPPORTED_PLATFORMS.includ EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index 3f6eb49..610ec5c 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -39,8 +39,8 @@ describe 'concat::fragment source', :unless => UNSUPPORTED_PLATFORMS.include?(fa EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/foo") do @@ -95,8 +95,8 @@ describe 'concat::fragment source', :unless => UNSUPPORTED_PLATFORMS.include?(fa EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/result_file1") do it { should be_file } diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index fb3f17d..f102bf1 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -19,8 +19,8 @@ describe 'concat ensure_newline parameter', :unless => UNSUPPORTED_PLATFORMS.inc EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -29,32 +29,4 @@ describe 'concat ensure_newline parameter', :unless => UNSUPPORTED_PLATFORMS.inc end end - #context '=> true' do - # pp = <<-EOS - # include concat::setup - # concat { '#{basedir}/file': - # ensure_newline => true, - # } - # concat::fragment { '1': - # target => '#{basedir}/file', - # content => '1', - # } - # concat::fragment { '2': - # target => '#{basedir}/file', - # content => '2', - # } - # EOS - - # it 'applies the manifest twice with no stderr' do - # expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - # expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") - # #XXX ensure_newline => true causes changes on every run because the files - # #are modified in place. - # end - - # describe file("#{basedir}/file") do - # it { should be_file } - # it { should contain "1\n2\n" } - # end - #end end diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index 1c79ab4..ff7e602 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -28,8 +28,8 @@ describe 'concat order', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamil EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/foo") do @@ -62,8 +62,8 @@ describe 'concat order', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamil EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/foo") do @@ -105,8 +105,8 @@ describe 'concat::fragment order', :unless => UNSUPPORTED_PLATFORMS.include?(fac EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/foo") do @@ -140,8 +140,8 @@ describe 'concat::fragment order', :unless => UNSUPPORTED_PLATFORMS.include?(fac EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/foo") do diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index e84140f..4d6c893 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -30,8 +30,8 @@ describe 'replacement of', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -69,8 +69,8 @@ describe 'replacement of', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -113,8 +113,8 @@ describe 'replacement of', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end # XXX specinfra doesn't support be_linked_to on AIX @@ -159,8 +159,8 @@ describe 'replacement of', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -236,8 +236,8 @@ describe 'replacement of', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do diff --git a/spec/acceptance/symbolic_name_spec.rb b/spec/acceptance/symbolic_name_spec.rb index 57a9e95..adba2c2 100644 --- a/spec/acceptance/symbolic_name_spec.rb +++ b/spec/acceptance/symbolic_name_spec.rb @@ -22,8 +22,8 @@ describe 'symbolic name', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do diff --git a/spec/acceptance/warn_spec.rb b/spec/acceptance/warn_spec.rb index b036884..11acc2e 100644 --- a/spec/acceptance/warn_spec.rb +++ b/spec/acceptance/warn_spec.rb @@ -23,8 +23,8 @@ describe 'concat warn =>', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -55,8 +55,8 @@ describe 'concat warn =>', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do @@ -87,8 +87,8 @@ describe 'concat warn =>', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfam EOS it 'applies the manifest twice with no stderr' do - expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("") - expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("") + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe file("#{basedir}/file") do From 13ae29d24badccd6ac9bf79e4af7e6bd779199bd Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 4 Jun 2014 14:04:16 -0400 Subject: [PATCH 29/34] Update for the 1.0.3 release being unsupported. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec049a0..cffb151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ -## - Supported Release 1.0.3 +##2014-06-04 - Release 1.0.3 ###Summary -This is a supported release. No functional changes were made from 1.0.2. +This release adds compatibility for PE3.3 and fixes tests. ####Features - Added test support for Ubuntu Trusty. From c0a918e4f31d7973d96ce702084ba0d021641a51 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Mon, 9 Jun 2014 11:30:17 -0400 Subject: [PATCH 30/34] Pin rspec to 2.x. --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 56b9775..814a2d8 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test do gem 'rake', :require => false + gem 'rspec', '~> 2.11', :require => false gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'beaker', :require => false From d25226e36ac2d8b3d5570a97ead2cf63e5891201 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 9 Jun 2014 17:11:51 -0400 Subject: [PATCH 31/34] Try to force it to use the correct version of beaker-rspec. --- Gemfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 814a2d8..4c72c2c 100644 --- a/Gemfile +++ b/Gemfile @@ -5,8 +5,7 @@ group :development, :test do gem 'rspec', '~> 2.11', :require => false gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'beaker', :require => false - gem 'beaker-rspec', :require => false + gem 'beaker-rspec', '>= 2.2', :require => false gem 'puppet-lint', :require => false gem 'serverspec', :require => false gem 'pry', :require => false From 90f70e86a329e351140f543e1b5ce55ff8d108e0 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Wed, 11 Jun 2014 17:25:08 -0400 Subject: [PATCH 32/34] 'wheel' is the root group for osx. --- spec/acceptance/concat_spec.rb | 3 +++ spec/acceptance/fragment_source_spec.rb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index d2950e7..708559a 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -4,6 +4,9 @@ case fact('osfamily') when 'AIX' username = 'root' groupname = 'system' +when 'Darwin' + username = 'root' + groupname = 'wheel' when 'windows' username = 'Administrator' groupname = 'Administrators' diff --git a/spec/acceptance/fragment_source_spec.rb b/spec/acceptance/fragment_source_spec.rb index 610ec5c..82a3cba 100644 --- a/spec/acceptance/fragment_source_spec.rb +++ b/spec/acceptance/fragment_source_spec.rb @@ -4,6 +4,9 @@ case fact('osfamily') when 'AIX' username = 'root' groupname = 'system' +when 'Darwin' + username = 'root' + groupname = 'wheel' when 'windows' username = 'Administrator' groupname = 'Administrators' From 070f184ce3331c757121eb44af3a5337f209cbb7 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 17 Jun 2014 11:00:54 -0400 Subject: [PATCH 33/34] Prep for 1.0.4 release. --- CHANGELOG.md | 14 ++++++++++++++ Modulefile | 2 +- metadata.json | 8 +++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cffb151..580f6c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +##2014-06-25 - Supported Release 1.0.4 +###Summary + +This release has test fixes. + +####Features +- Added test support for OSX. + +####Bugfixes + +####Known bugs + +* Not supported on Windows. + ##2014-06-04 - Release 1.0.3 ###Summary diff --git a/Modulefile b/Modulefile index 4f8a0aa..37a6bf1 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppetlabs-concat' -version '1.0.3' +version '1.0.4' source 'git://github.com/puppetlabs/puppetlabs-concat.git' author 'Puppetlabs' license 'Apache 2.0' diff --git a/metadata.json b/metadata.json index 25f9735..84ef010 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-concat", - "version": "1.0.3", + "version": "1.0.4", "source": "https://github.com/puppetlabs/puppetlabs-concat", "author": "Puppet Labs", "license": "Apache-2.0", @@ -77,6 +77,12 @@ "6.1", "7.1" ] + }, + { + "operatingsystem": "OSX", + "operatingsystemrelease": [ + "10.9" + ] } ], "requirements": [ From f81ef495e3fb48148b913468ef3f566b225a7bb3 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Wed, 10 Sep 2014 19:06:17 -0400 Subject: [PATCH 34/34] Fixing up tests --- spec/acceptance/backup_spec.rb | 52 ++++++++++++------- spec/acceptance/concat_spec.rb | 45 +++++++++++++---- spec/acceptance/empty_spec.rb | 1 - spec/acceptance/newline_spec.rb | 12 ++++- spec/acceptance/order_spec.rb | 1 - spec/acceptance/replace_spec.rb | 90 +++++++++++++++++++++------------ 6 files changed, 138 insertions(+), 63 deletions(-) diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index bd30c6c..1989f44 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -3,18 +3,24 @@ require 'spec_helper_acceptance' describe 'concat backup parameter' do basedir = default.tmpdir('concat') context '=> puppet' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + content => "old contents\n", + } + EOS + apply_manifest(pp) + end pp = <<-EOS - file { '#{basedir}/file': - content => "old contents\n", - } concat { '#{basedir}/file': - backup => 'puppet', - require => File['#{basedir}/file'], + backup => 'puppet', } concat::fragment { 'new file': target => '#{basedir}/file', content => 'new contents', - require => File['#{basedir}/file'], } EOS @@ -32,18 +38,24 @@ describe 'concat backup parameter' do end context '=> .backup' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + content => "old contents\n", + } + EOS + apply_manifest(pp) + end pp = <<-EOS - file { '#{basedir}/file': - content => "old contents\n", - } concat { '#{basedir}/file': - backup => '.backup', - require => File['#{basedir}/file'], + backup => '.backup', } concat::fragment { 'new file': target => '#{basedir}/file', content => 'new contents', - require => File['#{basedir}/file'], } EOS @@ -67,18 +79,24 @@ describe 'concat backup parameter' do # XXX The backup parameter uses validate_string() and thus can't be the # boolean false value, but the string 'false' has the same effect in Puppet 3 context "=> 'false'" do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + content => "old contents\n", + } + EOS + apply_manifest(pp) + end pp = <<-EOS - file { '#{basedir}/file': - content => "old contents\n", - } concat { '#{basedir}/file': backup => '.backup', - require => File['#{basedir}/file'], } concat::fragment { 'new file': target => '#{basedir}/file', content => 'new contents', - require => File['#{basedir}/file'], } EOS diff --git a/spec/acceptance/concat_spec.rb b/spec/acceptance/concat_spec.rb index 44a9a23..31c1647 100644 --- a/spec/acceptance/concat_spec.rb +++ b/spec/acceptance/concat_spec.rb @@ -17,6 +17,7 @@ end describe 'basic concat test' do basedir = default.tmpdir('concat') + safe_basedir = basedir.gsub('/','_') shared_examples 'successfully_applied' do |pp| it 'applies the manifest twice with no stderr' do @@ -32,7 +33,7 @@ describe 'basic concat test' do should be_mode 755 } end - describe file("#{default['puppetvardir']}/concat/bin") do + describe file("#{default['puppetvardir']}/concat/bin") do it { should be_directory } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -48,7 +49,7 @@ describe 'basic concat test' do should be_mode 755 } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file") do + describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file") do it { should be_directory } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -56,7 +57,7 @@ describe 'basic concat test' do should be_mode 750 } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments") do + describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments") do it { should be_directory } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -64,7 +65,7 @@ describe 'basic concat test' do should be_mode 750 } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments.concat") do + describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -72,7 +73,7 @@ describe 'basic concat test' do should be_mode 640 } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments.concat.out") do + describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat.out") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -83,6 +84,14 @@ describe 'basic concat test' do end context 'owner/group root' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + EOS + apply_manifest(pp) + end pp = <<-EOS concat { '#{basedir}/file': owner => '#{username}', @@ -105,7 +114,7 @@ describe 'basic concat test' do it_behaves_like 'successfully_applied', pp - describe file('#{basedir}/file') do + describe file("#{basedir}/file") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -115,7 +124,7 @@ describe 'basic concat test' do it { should contain '1' } it { should contain '2' } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do + describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/01_1") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -123,7 +132,7 @@ describe 'basic concat test' do should be_mode 640 } end - describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do + describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/02_2") do it { should be_file } it { should be_owned_by username } it { should be_grouped_into groupname } @@ -135,6 +144,14 @@ describe 'basic concat test' do context 'ensure' do context 'works when set to present with path set' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + EOS + apply_manifest(pp) + end pp=" concat { 'file': ensure => present, @@ -150,7 +167,7 @@ describe 'basic concat test' do it_behaves_like 'successfully_applied', pp - describe file('#{basedir}/file') do + describe file("#{basedir}/file") do it { should be_file } it("should be mode", :unless => (fact('osfamily') == 'AIX')) { should be_mode 644 @@ -159,6 +176,14 @@ describe 'basic concat test' do end end context 'works when set to absent with path set' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + EOS + apply_manifest(pp) + end pp=" concat { 'file': ensure => absent, @@ -177,7 +202,7 @@ describe 'basic concat test' do apply_manifest(pp, :catch_changes => true) end - describe file('#{basedir}/file') do + describe file("#{basedir}/file") do it { should_not be_file } end end diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb index 27175ab..dc57cb7 100644 --- a/spec/acceptance/empty_spec.rb +++ b/spec/acceptance/empty_spec.rb @@ -4,7 +4,6 @@ describe 'concat force empty parameter' do basedir = default.tmpdir('concat') context 'should run successfully' do pp = <<-EOS - include concat::setup concat { '#{basedir}/file': mode => '0644', force => true, diff --git a/spec/acceptance/newline_spec.rb b/spec/acceptance/newline_spec.rb index 95a32af..5554962 100644 --- a/spec/acceptance/newline_spec.rb +++ b/spec/acceptance/newline_spec.rb @@ -3,8 +3,16 @@ require 'spec_helper_acceptance' describe 'concat ensure_newline parameter' do basedir = default.tmpdir('concat') context '=> false' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory + } + EOS + + apply_manifest(pp) + end pp = <<-EOS - include concat::setup concat { '#{basedir}/file': ensure_newline => false, } @@ -49,7 +57,7 @@ describe 'concat ensure_newline parameter' do apply_manifest(pp, :catch_changes => true) end - describe file('#{basedir}/file') do + describe file("#{basedir}/file") do it { should be_file } it { should contain "1\n2\n" } end diff --git a/spec/acceptance/order_spec.rb b/spec/acceptance/order_spec.rb index a3c80b6..fd7b05b 100644 --- a/spec/acceptance/order_spec.rb +++ b/spec/acceptance/order_spec.rb @@ -5,7 +5,6 @@ describe 'concat order' do context '=> alpha' do pp = <<-EOS - include concat::setup concat { '#{basedir}/foo': order => 'alpha' } diff --git a/spec/acceptance/replace_spec.rb b/spec/acceptance/replace_spec.rb index 88e3524..c200cb2 100644 --- a/spec/acceptance/replace_spec.rb +++ b/spec/acceptance/replace_spec.rb @@ -4,25 +4,30 @@ describe 'replacement of' do basedir = default.tmpdir('concat') context 'file' do context 'should not succeed' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + content => "file exists\n" + } + EOS + apply_manifest(pp) + end pp = <<-EOS - file { '#{basedir}/file': - content => "file exists\n" - } concat { '#{basedir}/file': replace => false, - require => File['#{basedir}/file'], } concat::fragment { '1': target => '#{basedir}/file', content => '1', - require => File['#{basedir}/file'], } concat::fragment { '2': target => '#{basedir}/file', content => '2', - require => File['#{basedir}/file'], } EOS @@ -40,25 +45,30 @@ describe 'replacement of' do end context 'should succeed' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + content => "file exists\n" + } + EOS + apply_manifest(pp) + end pp = <<-EOS - file { '#{basedir}/file': - content => "file exists\n" - } concat { '#{basedir}/file': replace => true, - require => File['#{basedir}/file'], } concat::fragment { '1': target => '#{basedir}/file', content => '1', - require => File['#{basedir}/file'], } concat::fragment { '2': target => '#{basedir}/file', content => '2', - require => File['#{basedir}/file'], } EOS @@ -81,30 +91,32 @@ describe 'replacement of' do # XXX the core puppet file type will replace a symlink with a plain file # when using ensure => present and source => ... but it will not when using # ensure => present and content => ...; this is somewhat confusing behavior + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + ensure => link, + target => '#{basedir}/dangling', + } + EOS + apply_manifest(pp) + end pp = <<-EOS - file { '#{basedir}/file': - content => "file exists\n" - } - file { '{basedir}/dangling': - ensure => link, - target => File['#{basedir}/file'], - } concat { '#{basedir}/file': replace => false, - require => File['{basedir}/dangling'], } concat::fragment { '1': target => '#{basedir}/file', content => '1', - require => File['{basedir}/dangling'], } concat::fragment { '2': target => '#{basedir}/file', content => '2', - require => File['{basedir}/dangling'], } EOS @@ -129,29 +141,32 @@ describe 'replacement of' do # XXX the core puppet file type will replace a symlink with a plain file # when using ensure => present and source => ... but it will not when using # ensure => present and content => ...; this is somewhat confusing behavior + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + ensure => link, + target => '#{basedir}/dangling', + } + EOS + apply_manifest(pp) + end + pp = <<-EOS - file { '#{basedir}/file': - content => "file exists\n" - } - file { '{basedir}/dangling': - ensure => link, - target => File['#{basedir}/file'], - } concat { '#{basedir}/file': replace => true, - require => File['{basedir}/dangling'], } concat::fragment { '1': target => '#{basedir}/file', content => '1', - require => File['{basedir}/dangling'], } concat::fragment { '2': target => '#{basedir}/file', content => '2', - require => File['{basedir}/dangling'], } EOS @@ -170,6 +185,17 @@ describe 'replacement of' do context 'directory' do context 'should not succeed' do + before(:all) do + pp = <<-EOS + file { '#{basedir}': + ensure => directory, + } + file { '#{basedir}/file': + ensure => directory, + } + EOS + apply_manifest(pp) + end pp = <<-EOS concat { '#{basedir}/file': }