Skip to content

Commit

Permalink
Merge pull request #42 from chef/chris-rock/integration-test
Browse files Browse the repository at this point in the history
Split integration test preparation from executing
  • Loading branch information
arlimus committed Dec 21, 2015
2 parents aadc7ce + 7d57e70 commit 8c1b249
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 33 deletions.
35 changes: 2 additions & 33 deletions test/integration/cookbooks/test/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
40 changes: 40 additions & 0 deletions test/integration/cookbooks/test/recipes/prep_files.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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'
gid = 'system' if node['platform_family'] == 'aix'

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

0 comments on commit 8c1b249

Please sign in to comment.