From 5cc8a43ffecb7bff052eebb905f87bdbfca1d033 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Thu, 17 Dec 2015 23:50:37 +0100 Subject: [PATCH 1/2] split test preparation from test execution --- .../cookbooks/test/recipes/default.rb | 35 +---------------- .../cookbooks/test/recipes/prep_files.rb | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 test/integration/cookbooks/test/recipes/prep_files.rb diff --git a/test/integration/cookbooks/test/recipes/default.rb b/test/integration/cookbooks/test/recipes/default.rb index 1e2cff84..917ecdf6 100644 --- a/test/integration/cookbooks/test/recipes/default.rb +++ b/test/integration/cookbooks/test/recipes/default.rb @@ -9,38 +9,7 @@ # Finally (for now), it actually executes the all tests with # the local execution backend -gid = 'root' -gid = 'wheel' if node['platform_family'] == 'freebsd' - -file '/tmp/file' do - mode '0765' - owner 'root' - group gid - content 'hello world' -end - -directory '/tmp/folder' do - mode '0567' - owner 'root' - group gid -end - -link '/tmp/symlink'do - to '/tmp/file' - owner 'root' - group gid - mode '0777' -end - -execute 'create pipe/fifo' do - command 'mkfifo /tmp/pipe' - not_if 'test -e /tmp/pipe' -end - -execute 'create block_device' do - command "mknod /tmp/block_device b 7 7 && chmod 0666 /tmp/block_device && chown root:#{gid} /tmp/block_device" - not_if 'test -e /tmp/block_device' -end +include_recipe('test::prep_files') # prepare ssh for backend execute 'create ssh key' do @@ -78,7 +47,7 @@ # execute tests execute 'bundle install' do - command '/opt/chef/embedded/bin/bundle install' + command '/opt/chef/embedded/bin/bundle install --without integration tools' cwd '/tmp/kitchen/data' end diff --git a/test/integration/cookbooks/test/recipes/prep_files.rb b/test/integration/cookbooks/test/recipes/prep_files.rb new file mode 100644 index 00000000..120df39c --- /dev/null +++ b/test/integration/cookbooks/test/recipes/prep_files.rb @@ -0,0 +1,39 @@ +# encoding: utf-8 +# author: Dominik Richter +# author: Christoph Hartmann +# +# Helper recipe to create create a few files in the operating +# systems, which the runner will test against. + +gid = 'root' +gid = 'wheel' if node['platform_family'] == 'freebsd' + +file '/tmp/file' do + mode '0765' + owner 'root' + group gid + content 'hello world' +end + +directory '/tmp/folder' do + mode '0567' + owner 'root' + group gid +end + +link '/tmp/symlink'do + to '/tmp/file' + owner 'root' + group gid + mode '0777' +end + +execute 'create pipe/fifo' do + command 'mkfifo /tmp/pipe' + not_if 'test -e /tmp/pipe' +end + +execute 'create block_device' do + command "mknod /tmp/block_device b 7 7 && chmod 0666 /tmp/block_device && chown root:#{gid} /tmp/block_device" + not_if 'test -e /tmp/block_device' +end From 7d57e7005c0a5444b475b5beec9fefe17ab59bc7 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Thu, 17 Dec 2015 23:51:23 +0100 Subject: [PATCH 2/2] use system user for aix --- test/integration/cookbooks/test/recipes/prep_files.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integration/cookbooks/test/recipes/prep_files.rb b/test/integration/cookbooks/test/recipes/prep_files.rb index 120df39c..dd740233 100644 --- a/test/integration/cookbooks/test/recipes/prep_files.rb +++ b/test/integration/cookbooks/test/recipes/prep_files.rb @@ -7,6 +7,7 @@ gid = 'root' gid = 'wheel' if node['platform_family'] == 'freebsd' +gid = 'system' if node['platform_family'] == 'aix' file '/tmp/file' do mode '0765'