summaryrefslogtreecommitdiff
path: root/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
diff options
context:
space:
mode:
Diffstat (limited to 'acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb')
-rw-r--r--acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
index c2d65b4b0c..0f9982f9ad 100644
--- a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
+++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb
@@ -2,9 +2,9 @@ class CookbookKitchen < KitchenAcceptance::Kitchen
resource_name :cookbook_kitchen
property :command, default: lazy { name.split(" ")[0] }
- property :test_cookbook, default: lazy { name.split(" ")[1] }
- property :kitchen_dir, default: lazy { ::File.join(Chef.node["chef-acceptance"]["suite-dir"], "test_run", test_cookbook) }
- property :repository, default: lazy { "chef-cookbooks/#{test_cookbook}" },
+ property :kitchen_dir, default: lazy { ::File.join(repository_root, cookbook_relative_dir) }
+ property :test_cookbook, String, default: lazy { name.split(" ")[1] }
+ property :repository, String, default: lazy { "chef-cookbooks/#{test_cookbook}" },
coerce: proc { |v|
# chef-cookbooks/runit -> https://github.com/chef-cookbooks/runit.git
if !v.include?(':')
@@ -13,7 +13,9 @@ class CookbookKitchen < KitchenAcceptance::Kitchen
v
end
}
- property :branch, default: "master"
+ property :repository_root, String, default: lazy { ::File.join(Chef.node["chef-acceptance"]["suite-dir"], "test_run", test_cookbook) }
+ property :branch, String, default: "master"
+ property :cookbook_relative_dir, String
property :env, default: lazy {
{
"BUNDLE_GEMFILE" => ::File.expand_path("../Gemfile", Chef.node["chef-acceptance"]["suite-dir"]),
@@ -25,15 +27,17 @@ class CookbookKitchen < KitchenAcceptance::Kitchen
action :run do
if command == "converge"
# Ensure the parent directory exists
- directory ::File.expand_path("..", kitchen_dir)
+ directory ::File.expand_path("..", repository_root) do
+ recursive true
+ end
# Grab the cookbook
# TODO Grab the source URL from supermarket
# TODO get git to include its kitchen tests in the cookbook.
- git kitchen_dir do
- repository new_resource.repository
- branch new_resource.branch
- end
+ # git repository_root do
+ # repository new_resource.repository
+ # branch new_resource.branch
+ # end
end
super()