Skip to content

Commit

Permalink
add test to make sure notification is sent when ark resource is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwb committed May 21, 2012
1 parent 05a72a3 commit 68d7783
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions files/default/tests/minitest/test_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,9 @@
file("/usr/local/foo_tbz/foo1.txt").must_exist
file("/usr/local/foo_tgz/foo1.txt").must_exist
end

it "sends notification when resource updated" do
file("/tmp/foobarbaz/notification_successful.txt").must_exist
end

end
25 changes: 25 additions & 0 deletions recipes/test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
require 'fileutils'

# remove file so we can test sending notification on its creation
if ::File.exist? "/tmp/foobarbaz/foo1.txt"
FileUtils.rm_f "/tmp/foobarbaz/foo1.txt"
end

ruby_block "test_notification" do
block do
if ::File.exist? "/tmp/foobarbaz/foo1.txt"
FileUtils.touch "/tmp/foobarbaz/notification_successful.txt"
end
end
action :nothing
end


user 'foobarbaz'

directory "/opt/bin" do
Expand Down Expand Up @@ -90,3 +107,11 @@
url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tgz'
version '3'
end

ark "test notification" do
url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.zip'
path "/tmp/foobarbaz"
creates "foo1.txt"
action :dump
notifies :create, "ruby_block[test_notification]", :immediately
end

0 comments on commit 68d7783

Please sign in to comment.