Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Commit

Permalink
A test case that demonstrates #86
Browse files Browse the repository at this point in the history
First thing's first.
  • Loading branch information
matschaffer committed Feb 10, 2013
1 parent a6ed4e1 commit 87642af
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/integration/cases/cache_path_usage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module CachePathUsage
def setup
super
FileUtils.cp_r $base_dir.join('support', 'cache_using_cookbook'), 'cookbooks/cache_using_cookbook'
end

def test_changing_a_cached_directory_between_cooks
write_nodefile(run_count: 1, run_list: ["cache_using_cookbook"])
assert_subcommand "cook"
write_nodefile(run_count: 2, run_list: ["cache_using_cookbook"])
assert_subcommand "cook"
end
end
1 change: 1 addition & 0 deletions test/integration/ubuntu12_04_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ def image_id
include EmptyCook
include Apache2Cook
include EncryptedDataBag
include CachePathUsage
end
7 changes: 7 additions & 0 deletions test/support/cache_using_cookbook/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name 'cache_using_cookbook'
maintainer 'Mat Schaffer'
maintainer_email '[email protected]'
license 'MIT'
description 'Writes some data to the cache path.'
long_description 'This helps ensure that we can do this multiple times regardless of what user initiates the run.'
version '0.1.0'
33 changes: 33 additions & 0 deletions test/support/cache_using_cookbook/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Cookbook Name:: cache_using_cookbook
# Recipe:: default
#
# Copyright 2013, Mat Schaffer
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

container = Chef::Config[:file_cache_path] + "/test_dir"

directory container

file container + "/test_file" do
content "This was generated from run #{node['run_count']}"
end

5 comments on commit 87642af

@tmatilai
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to update the manifest. =)

@matschaffer
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a fair point. Would you be okay tying the manifest to the default rake task? I typically run rake to make sure everything's kosher so that would encourage me to make sure it's up to date.

@tmatilai
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfect for me. Or even better if there default task failed if the manifest is/was not up-to-date. But a dirty working tree is also enough feedback for me.

@matschaffer
Copy link
Owner Author

@matschaffer matschaffer commented on 87642af Feb 11, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmatilai
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a great idea!

Please sign in to comment.