Skip to content

Instantly share code, notes, and snippets.

@johnduarte
Created May 26, 2015 22:41
Show Gist options
  • Save johnduarte/42f6f9bc0fcf17fcbe09 to your computer and use it in GitHub Desktop.
Save johnduarte/42f6f9bc0fcf17fcbe09 to your computer and use it in GitHub Desktop.
exec test for Shaigy
test_name "Test exec subscribed to file" do
manifest =<<EOS
$thing = "hi there"
...
...
exec {'cp /root/mytestfile.rb /root/newtestfile.rb'}
EOS
step "Create manifest" do
apply_manifest_on(master, manifest)
master.file_exists? "/root/mytestfile.rb"
master.file_exists? "/root/newtestfile.rb"
end
step "Change testfile" do
on master, "echo 'foo' >> /root/mytestfile.rb"
apply_manifest_on(master, manifest)
master.file_exists? "/root/mytestfile.rb"
result = on master, "cat /root/newtestfile.rb"
fail unless result.stdout.matches "foo"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment