cuken 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. data/Gemfile +5 -3
  2. data/Gemfile.lock +61 -18
  3. data/LICENSE +13 -0
  4. data/NOTICE +3 -0
  5. data/Rakefile +3 -3
  6. data/VERSION +1 -1
  7. data/cucumber.yml +8 -0
  8. data/cuken.gemspec +397 -13
  9. data/examples/chef/features/support/env.rb +16 -0
  10. data/features/chef/cookbooks/cookbook.feature +14 -0
  11. data/features/chef/cookbooks/metadata.feature +40 -0
  12. data/features/chef/cookbooks/repo.feature +13 -0
  13. data/features/chef/knife.feature +140 -0
  14. data/features/chef/knife_steps.feature +19 -0
  15. data/features/command_steps.feature +68 -0
  16. data/features/commands.feature +5 -5
  17. data/features/common_steps.feature +13 -0
  18. data/features/data/Rakefile +38 -0
  19. data/features/data/apt/chef-integration-test-1.0/debian/changelog +5 -0
  20. data/features/data/apt/chef-integration-test-1.0/debian/compat +1 -0
  21. data/features/data/apt/chef-integration-test-1.0/debian/control +13 -0
  22. data/features/data/apt/chef-integration-test-1.0/debian/copyright +34 -0
  23. data/features/data/apt/chef-integration-test-1.0/debian/files +1 -0
  24. data/features/data/apt/chef-integration-test-1.0/debian/rules +13 -0
  25. data/features/data/apt/chef-integration-test-1.0/debian/source/format +1 -0
  26. data/features/data/apt/chef-integration-test-1.1/debian/changelog +11 -0
  27. data/features/data/apt/chef-integration-test-1.1/debian/compat +1 -0
  28. data/features/data/apt/chef-integration-test-1.1/debian/control +13 -0
  29. data/features/data/apt/chef-integration-test-1.1/debian/copyright +34 -0
  30. data/features/data/apt/chef-integration-test-1.1/debian/files +1 -0
  31. data/features/data/apt/chef-integration-test-1.1/debian/rules +13 -0
  32. data/features/data/apt/chef-integration-test-1.1/debian/source/format +1 -0
  33. data/features/data/apt/chef-integration-test_1.0-1_amd64.changes +22 -0
  34. data/features/data/apt/chef-integration-test_1.0-1_amd64.deb +0 -0
  35. data/features/data/apt/chef-integration-test_1.0.orig.tar.gz +0 -0
  36. data/features/data/apt/chef-integration-test_1.1-1_amd64.changes +22 -0
  37. data/features/data/apt/chef-integration-test_1.1-1_amd64.deb +0 -0
  38. data/features/data/apt/chef-integration-test_1.1.orig.tar.gz +0 -0
  39. data/features/data/apt/var/www/apt/conf/distributions +7 -0
  40. data/features/data/apt/var/www/apt/conf/incoming +4 -0
  41. data/features/data/apt/var/www/apt/conf/pulls +3 -0
  42. data/features/data/apt/var/www/apt/db/checksums.db +0 -0
  43. data/features/data/apt/var/www/apt/db/contents.cache.db +0 -0
  44. data/features/data/apt/var/www/apt/db/packages.db +0 -0
  45. data/features/data/apt/var/www/apt/db/references.db +0 -0
  46. data/features/data/apt/var/www/apt/db/release.caches.db +0 -0
  47. data/features/data/apt/var/www/apt/db/version +4 -0
  48. data/features/data/apt/var/www/apt/dists/sid/Release +19 -0
  49. data/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages +16 -0
  50. data/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz +0 -0
  51. data/features/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release +5 -0
  52. data/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb +0 -0
  53. data/features/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb +0 -0
  54. data/features/data/config/client.rb +23 -0
  55. data/features/data/config/client_with_checksum_caching.rb +23 -0
  56. data/features/data/config/knife-stephen.rb +12 -0
  57. data/features/data/config/knife.rb +11 -0
  58. data/features/data/config/rake.rb +57 -0
  59. data/features/data/config/server.rb +52 -0
  60. data/features/data/cookbook_tarballs/empty_tarball.tar.gz +0 -0
  61. data/features/data/cookbook_tarballs/new.tar.gz +0 -0
  62. data/features/data/cookbook_tarballs/not_a_tarball.txt +1 -0
  63. data/features/data/cookbook_tarballs/original.tar.gz +0 -0
  64. data/features/data/cookbooks/attribute_include/README.rdoc +8 -0
  65. data/features/data/cookbooks/attribute_include/attributes/a.rb +4 -0
  66. data/features/data/cookbooks/attribute_include/attributes/b.rb +2 -0
  67. data/features/data/cookbooks/attribute_include/metadata.rb +6 -0
  68. data/features/data/cookbooks/attribute_include/recipes/default.rb +23 -0
  69. data/features/data/cookbooks/attribute_include_default/README.rdoc +8 -0
  70. data/features/data/cookbooks/attribute_include_default/attributes/a.rb +5 -0
  71. data/features/data/cookbooks/attribute_include_default/attributes/default.rb +2 -0
  72. data/features/data/cookbooks/attribute_include_default/metadata.rb +6 -0
  73. data/features/data/cookbooks/attribute_include_default/recipes/default.rb +23 -0
  74. data/features/data/cookbooks/attribute_settings/README.rdoc +8 -0
  75. data/features/data/cookbooks/attribute_settings/attributes/default.rb +3 -0
  76. data/features/data/cookbooks/attribute_settings/default.rb +1 -0
  77. data/features/data/cookbooks/attribute_settings/metadata.rb +6 -0
  78. data/features/data/cookbooks/attribute_settings/recipes/default.rb +21 -0
  79. data/features/data/cookbooks/attribute_settings/recipes/default_in_recipe.rb +25 -0
  80. data/features/data/cookbooks/attribute_settings_normal/README.rdoc +8 -0
  81. data/features/data/cookbooks/attribute_settings_normal/attributes/.default.rb.swo +0 -0
  82. data/features/data/cookbooks/attribute_settings_normal/attributes/default.rb +2 -0
  83. data/features/data/cookbooks/attribute_settings_normal/default.rb +1 -0
  84. data/features/data/cookbooks/attribute_settings_normal/metadata.rb +6 -0
  85. data/features/data/cookbooks/attribute_settings_normal/recipes/.default.rb.swo +0 -0
  86. data/features/data/cookbooks/attribute_settings_normal/recipes/.default_in_recipe.rb.swo +0 -0
  87. data/features/data/cookbooks/attribute_settings_normal/recipes/default.rb +21 -0
  88. data/features/data/cookbooks/attribute_settings_normal/recipes/normal_in_recipe.rb +25 -0
  89. data/features/data/cookbooks/attribute_settings_override/README.rdoc +8 -0
  90. data/features/data/cookbooks/attribute_settings_override/attributes/default.rb +2 -0
  91. data/features/data/cookbooks/attribute_settings_override/default.rb +1 -0
  92. data/features/data/cookbooks/attribute_settings_override/metadata.rb +6 -0
  93. data/features/data/cookbooks/attribute_settings_override/recipes/default.rb +21 -0
  94. data/features/data/cookbooks/attribute_settings_override/recipes/normal_in_recipe.rb +25 -0
  95. data/features/data/cookbooks/attribute_settings_override/recipes/override_in_recipe.rb +21 -0
  96. data/features/data/cookbooks/delayed_notifications/recipes/bad_syntax_notifies.rb +14 -0
  97. data/features/data/cookbooks/delayed_notifications/recipes/default.rb +18 -0
  98. data/features/data/cookbooks/delayed_notifications/recipes/forward_references.rb +10 -0
  99. data/features/data/cookbooks/delayed_notifications/recipes/invalid_forward_reference.rb +16 -0
  100. data/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_a_single_source.rb +26 -0
  101. data/features/data/cookbooks/delayed_notifications/recipes/notify_a_resource_from_multiple_sources.rb +31 -0
  102. data/features/data/cookbooks/delayed_notifications/recipes/notify_different_resources_for_different_actions.rb +31 -0
  103. data/features/data/cookbooks/deploy/recipes/callbacks.rb +78 -0
  104. data/features/data/cookbooks/deploy/recipes/default.rb +51 -0
  105. data/features/data/cookbooks/deploy/recipes/deploy_commit1.rb +25 -0
  106. data/features/data/cookbooks/deploy/recipes/deploy_commit2.rb +25 -0
  107. data/features/data/cookbooks/deploy/recipes/embedded_recipe_callbacks.rb +70 -0
  108. data/features/data/cookbooks/deploy/recipes/revision_deploy.rb +51 -0
  109. data/features/data/cookbooks/deploy/recipes/rollback_commit2.rb +24 -0
  110. data/features/data/cookbooks/deploy/templates/default/app_config.yml.erb +23 -0
  111. data/features/data/cookbooks/deploy/templates/default/database.yml.erb +18 -0
  112. data/features/data/cookbooks/deploy/templates/default/embedded_recipe_before_symlink.rb.erb +4 -0
  113. data/features/data/cookbooks/deploy/templates/default/sneaky_after_restart_hook.rb.erb +4 -0
  114. data/features/data/cookbooks/deploy/templates/default/sneaky_before_migrate_hook.rb.erb +2 -0
  115. data/features/data/cookbooks/deploy/templates/default/sneaky_before_restart_hook.rb.erb +4 -0
  116. data/features/data/cookbooks/deploy/templates/default/sneaky_before_symlink_hook.rb.erb +2 -0
  117. data/features/data/cookbooks/directory_provider/recipes/create.rb +25 -0
  118. data/features/data/cookbooks/directory_provider/recipes/default.rb +18 -0
  119. data/features/data/cookbooks/directory_provider/recipes/delete.rb +29 -0
  120. data/features/data/cookbooks/directory_provider/recipes/delete_nonexistent.rb +23 -0
  121. data/features/data/cookbooks/directory_provider/recipes/owner_update.rb +31 -0
  122. data/features/data/cookbooks/directory_provider/recipes/set_the_accessibility_of_a_created_directory.rb +55 -0
  123. data/features/data/cookbooks/execute_commands/metadata.rb +5 -0
  124. data/features/data/cookbooks/execute_commands/recipes/4k.rb +25 -0
  125. data/features/data/cookbooks/execute_commands/recipes/debug.rb +22 -0
  126. data/features/data/cookbooks/execute_commands/recipes/default.rb +22 -0
  127. data/features/data/cookbooks/execute_commands/recipes/umask.rb +23 -0
  128. data/features/data/cookbooks/integration_setup/attributes/integration.rb +25 -0
  129. data/features/data/cookbooks/integration_setup/recipes/default.rb +24 -0
  130. data/features/data/cookbooks/lwrp/providers/default.rb +9 -0
  131. data/features/data/cookbooks/lwrp/providers/lwp_non_default.rb +3 -0
  132. data/features/data/cookbooks/lwrp/providers/lwp_overridden_load_current_resource.rb +8 -0
  133. data/features/data/cookbooks/lwrp/providers/provider_is_omitted.rb +3 -0
  134. data/features/data/cookbooks/lwrp/recipes/default_everything.rb +4 -0
  135. data/features/data/cookbooks/lwrp/recipes/non_default_provider.rb +6 -0
  136. data/features/data/cookbooks/lwrp/recipes/non_default_resource.rb +6 -0
  137. data/features/data/cookbooks/lwrp/recipes/overridden_provider_load_current_resource.rb +6 -0
  138. data/features/data/cookbooks/lwrp/recipes/overridden_resource_initialize.rb +6 -0
  139. data/features/data/cookbooks/lwrp/recipes/provider_invokes_resource.rb +6 -0
  140. data/features/data/cookbooks/lwrp/recipes/provider_is_a_class.rb +6 -0
  141. data/features/data/cookbooks/lwrp/recipes/provider_is_a_string.rb +6 -0
  142. data/features/data/cookbooks/lwrp/recipes/provider_is_a_symbol.rb +6 -0
  143. data/features/data/cookbooks/lwrp/recipes/provider_is_omitted.rb +3 -0
  144. data/features/data/cookbooks/lwrp/resources/default.rb +4 -0
  145. data/features/data/cookbooks/lwrp/resources/lwr_non_default.rb +3 -0
  146. data/features/data/cookbooks/lwrp/resources/lwr_overridden_initialize.rb +8 -0
  147. data/features/data/cookbooks/lwrp/resources/provider_is_omitted.rb +1 -0
  148. data/features/data/cookbooks/manage_files/recipes/create_a_file.rb +22 -0
  149. data/features/data/cookbooks/manage_files/recipes/default.rb +19 -0
  150. data/features/data/cookbooks/manage_files/recipes/delete_a_file.rb +24 -0
  151. data/features/data/cookbooks/manage_files/recipes/delete_a_file_that_does_not_already_exist.rb +22 -0
  152. data/features/data/cookbooks/manage_files/recipes/manage_file_contents.rb +23 -0
  153. data/features/data/cookbooks/manage_files/recipes/set_the_accessibility_of_a_created_file.rb +79 -0
  154. data/features/data/cookbooks/manage_files/recipes/set_the_owner_of_a_created_file.rb +23 -0
  155. data/features/data/cookbooks/manage_files/recipes/touch_a_file.rb +22 -0
  156. data/features/data/cookbooks/metadata/metadata.rb +17 -0
  157. data/features/data/cookbooks/metadata/recipes/default.rb +18 -0
  158. data/features/data/cookbooks/no_attributes/README.rdoc +8 -0
  159. data/features/data/cookbooks/no_attributes/metadata.rb +6 -0
  160. data/features/data/cookbooks/no_attributes/recipes/default.rb +21 -0
  161. data/features/data/cookbooks/node_cookbook_sync/README.rdoc +8 -0
  162. data/features/data/cookbooks/node_cookbook_sync/attributes/attr_file.rb +0 -0
  163. data/features/data/cookbooks/node_cookbook_sync/definitions/def_file.rb +0 -0
  164. data/features/data/cookbooks/node_cookbook_sync/libraries/lib_file.rb +0 -0
  165. data/features/data/cookbooks/node_cookbook_sync/metadata.rb +6 -0
  166. data/features/data/cookbooks/node_cookbook_sync/recipes/default.rb +18 -0
  167. data/features/data/cookbooks/packages/recipes/default.rb +0 -0
  168. data/features/data/cookbooks/packages/recipes/gem_package.rb +26 -0
  169. data/features/data/cookbooks/packages/recipes/install_apt_package.rb +3 -0
  170. data/features/data/cookbooks/packages/recipes/install_dpkg_package.rb +4 -0
  171. data/features/data/cookbooks/packages/recipes/install_gem_noshell.rb +26 -0
  172. data/features/data/cookbooks/packages/recipes/install_gem_package_twice.rb +26 -0
  173. data/features/data/cookbooks/packages/recipes/macports_install_bad_package.rb +3 -0
  174. data/features/data/cookbooks/packages/recipes/macports_install_yydecode.rb +3 -0
  175. data/features/data/cookbooks/packages/recipes/macports_purge_yydecode.rb +3 -0
  176. data/features/data/cookbooks/packages/recipes/macports_remove_yydecode.rb +3 -0
  177. data/features/data/cookbooks/packages/recipes/macports_upgrade_yydecode.rb +7 -0
  178. data/features/data/cookbooks/packages/recipes/manually_upgrade_gem_package.rb +32 -0
  179. data/features/data/cookbooks/packages/recipes/upgrade_gem_noshell.rb +33 -0
  180. data/features/data/cookbooks/packages/recipes/upgrade_gem_package.rb +33 -0
  181. data/features/data/cookbooks/recipe_include/README.rdoc +8 -0
  182. data/features/data/cookbooks/recipe_include/metadata.rb +6 -0
  183. data/features/data/cookbooks/recipe_include/recipes/default.rb +21 -0
  184. data/features/data/cookbooks/recipe_include/recipes/second.rb +23 -0
  185. data/features/data/cookbooks/roles/recipes/default.rb +26 -0
  186. data/features/data/cookbooks/roles/recipes/env_test.rb +25 -0
  187. data/features/data/cookbooks/run_interval/recipes/default.rb +27 -0
  188. data/features/data/cookbooks/scm/metadata.rb +8 -0
  189. data/features/data/cookbooks/scm/recipes/git.rb +25 -0
  190. data/features/data/cookbooks/search/attributes/search_attrs.rb +1 -0
  191. data/features/data/cookbooks/search/recipes/default.rb +18 -0
  192. data/features/data/cookbooks/search/recipes/search_data.rb +28 -0
  193. data/features/data/cookbooks/search/recipes/search_data_manual.rb +33 -0
  194. data/features/data/cookbooks/search/recipes/search_data_noblock.rb +32 -0
  195. data/features/data/cookbooks/show_cookbook/README.rdoc +8 -0
  196. data/features/data/cookbooks/show_cookbook/attributes/attr_file.rb +0 -0
  197. data/features/data/cookbooks/show_cookbook/definitions/def_file.rb +0 -0
  198. data/features/data/cookbooks/show_cookbook/files/default/prime_time.txt +0 -0
  199. data/features/data/cookbooks/show_cookbook/files/host-latte/prime_time.txt +0 -0
  200. data/features/data/cookbooks/show_cookbook/files/mac_os_x-10.5/prime_time.txt +0 -0
  201. data/features/data/cookbooks/show_cookbook/files/mac_os_x/prime_time.txt +0 -0
  202. data/features/data/cookbooks/show_cookbook/libraries/lib_file.rb +0 -0
  203. data/features/data/cookbooks/show_cookbook/metadata.rb +6 -0
  204. data/features/data/cookbooks/show_cookbook/recipes/default.rb +18 -0
  205. data/features/data/cookbooks/show_cookbook/templates/default/prime_time.txt.erb +0 -0
  206. data/features/data/cookbooks/show_cookbook/templates/host-latte/prime_time.txt.erb +0 -0
  207. data/features/data/cookbooks/show_cookbook/templates/mac_os_x-10.5/prime_time.txt.erb +0 -0
  208. data/features/data/cookbooks/show_cookbook/templates/mac_os_x/prime_time.txt.erb +0 -0
  209. data/features/data/cookbooks/synchronize/recipes/default.rb +18 -0
  210. data/features/data/cookbooks/synchronize_deps/metadata.json +30 -0
  211. data/features/data/cookbooks/synchronize_deps/metadata.rb +1 -0
  212. data/features/data/cookbooks/synchronize_deps/recipes/default.rb +18 -0
  213. data/features/data/cookbooks/template/README.rdoc +8 -0
  214. data/features/data/cookbooks/template/metadata.rb +6 -0
  215. data/features/data/cookbooks/template/recipes/default.rb +26 -0
  216. data/features/data/cookbooks/template/recipes/interval.rb +37 -0
  217. data/features/data/cookbooks/template/recipes/render_node_attrs.rb +26 -0
  218. data/features/data/cookbooks/template/templates/default/node.txt.erb +3 -0
  219. data/features/data/cookbooks/template/templates/default/template.txt.erb +1 -0
  220. data/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/bar.txt +1 -0
  221. data/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/baz.txt +1 -0
  222. data/features/data/cookbooks/transfer_remote_directories/files/default/transfer_directory_feature/foo.txt +1 -0
  223. data/features/data/cookbooks/transfer_remote_directories/recipes/transfer_directory.rb +29 -0
  224. data/features/data/cookbooks/transfer_remote_files/files/default/transfer_a_file_from_a_cookbook.txt +1 -0
  225. data/features/data/cookbooks/transfer_remote_files/metadata.json +30 -0
  226. data/features/data/cookbooks/transfer_remote_files/metadata.rb +1 -0
  227. data/features/data/cookbooks/transfer_remote_files/recipes/change_remote_file_perms_trickery.rb +33 -0
  228. data/features/data/cookbooks/transfer_remote_files/recipes/default.rb +18 -0
  229. data/features/data/cookbooks/transfer_remote_files/recipes/should_prefer_the_file_for_this_specific_host.rb +22 -0
  230. data/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_cookbook.rb +22 -0
  231. data/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_file_from_a_specific_cookbook.rb +20 -0
  232. data/features/data/cookbooks/transfer_remote_files/recipes/transfer_a_non-existent_file_from_a_cookbook.rb +22 -0
  233. data/features/data/cookbooks/transfer_remote_files_definition/definitions/transfer.rb +6 -0
  234. data/features/data/cookbooks/transfer_remote_files_definition/files/default/easy.txt +1 -0
  235. data/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_be_transferred.txt +3 -0
  236. data/features/data/cookbooks/transfer_some_cookbook_files/files/default/should_not_be_transferred.txt +2 -0
  237. data/features/data/cookbooks/transfer_some_cookbook_files/recipes/default.rb +26 -0
  238. data/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_be_transferred.erb +2 -0
  239. data/features/data/cookbooks/transfer_some_cookbook_files/templates/default/should_not_be_transferred.erb +3 -0
  240. data/features/data/cookbooks/version_deps/metadata.rb +1 -0
  241. data/features/data/cookbooks/version_deps/recipes/default.rb +1 -0
  242. data/features/data/cookbooks/versions/metadata.rb +5 -0
  243. data/features/data/cookbooks/versions/recipes/default.rb +5 -0
  244. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.json +31 -0
  245. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/metadata.rb +8 -0
  246. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_1.0.0/recipes/default.rb +18 -0
  247. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.json +29 -0
  248. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/metadata.rb +6 -0
  249. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_2.0.0/recipes/default.rb +18 -0
  250. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.json +30 -0
  251. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/metadata.rb +7 -0
  252. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_a_3.0.0/recipes/default.rb +18 -0
  253. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.json +31 -0
  254. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/metadata.rb +8 -0
  255. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_1.0.0/recipes/default.rb +18 -0
  256. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.json +31 -0
  257. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/metadata.rb +8 -0
  258. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_2.0.0/recipes/default.rb +18 -0
  259. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.json +30 -0
  260. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/metadata.rb +7 -0
  261. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_b_3.0.0/recipes/default.rb +18 -0
  262. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.json +31 -0
  263. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/metadata.rb +8 -0
  264. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_1.0.0/recipes/default.rb +18 -0
  265. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.json +29 -0
  266. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/metadata.rb +6 -0
  267. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_2.0.0/recipes/default.rb +18 -0
  268. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.json +29 -0
  269. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/metadata.rb +6 -0
  270. data/features/data/cookbooks_not_uploaded_at_feature_start/dep_test_c_3.0.0/recipes/default.rb +18 -0
  271. data/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr1.rb +1 -0
  272. data/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/attributes/attr2.rb +1 -0
  273. data/features/data/cookbooks_not_uploaded_at_feature_start/test_cookbook/recipes/default.rb +2 -0
  274. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.json +38 -0
  275. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_empty_except_metadata/metadata.rb +6 -0
  276. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/attributes/attributes.rb +1 -0
  277. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_invalid_nometadata/recipes/default.rb +2 -0
  278. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/attributes/attributes.rb +1 -0
  279. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.json +38 -0
  280. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/metadata.rb +6 -0
  281. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid/recipes/default.rb +2 -0
  282. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/attributes/attributes.rb +1 -0
  283. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.json +40 -0
  284. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/metadata.rb +7 -0
  285. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.1.0_with_different_dependencies/recipes/default.rb +2 -0
  286. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/attributes/attributes.rb +1 -0
  287. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.json +38 -0
  288. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/metadata.rb +6 -0
  289. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_valid_v0.2.0/recipes/default.rb +2 -0
  290. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/metadata.json +40 -0
  291. data/features/data/cookbooks_not_uploaded_at_feature_start/testcookbook_wrong_metadata/recipes/default.rb +1 -0
  292. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.json +39 -0
  293. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/metadata.rb +6 -0
  294. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.0/recipes/default.rb +18 -0
  295. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.json +39 -0
  296. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/metadata.rb +6 -0
  297. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.1.1/recipes/default.rb +18 -0
  298. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json +39 -0
  299. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb +6 -0
  300. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb +18 -0
  301. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.json +39 -0
  302. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/metadata.rb +6 -0
  303. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.2.0/recipes/default.rb +18 -0
  304. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json +39 -0
  305. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb +6 -0
  306. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb +18 -0
  307. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json +39 -0
  308. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb +6 -0
  309. data/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb +18 -0
  310. data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/attributes/attributes.rb +1 -0
  311. data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.json +29 -0
  312. data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/metadata.rb +6 -0
  313. data/features/data/cookbooks_not_uploaded_at_feature_start/version_updated/recipes/default.rb +2 -0
  314. data/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.json +38 -0
  315. data/features/data/cookbooks_not_uploaded_at_feature_start/versions/metadata.rb +5 -0
  316. data/features/data/cookbooks_not_uploaded_at_feature_start/versions/recipes/default.rb +5 -0
  317. data/features/data/gems/Marshal.4.8 +0 -0
  318. data/features/data/gems/Marshal.4.8.Z +0 -0
  319. data/features/data/gems/latest_specs.4.8 +0 -0
  320. data/features/data/gems/latest_specs.4.8.gz +0 -0
  321. data/features/data/gems/prerelease_specs.4.8 +0 -0
  322. data/features/data/gems/prerelease_specs.4.8.gz +0 -0
  323. data/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.0.gemspec.rz +0 -0
  324. data/features/data/gems/quick/Marshal.4.8/chef-integration-test-0.1.1.gemspec.rz +0 -0
  325. data/features/data/gems/quick/chef-integration-test-0.1.0.gemspec.rz +0 -0
  326. data/features/data/gems/quick/chef-integration-test-0.1.1.gemspec.rz +0 -0
  327. data/features/data/gems/quick/index +2 -0
  328. data/features/data/gems/quick/index.rz +0 -0
  329. data/features/data/gems/quick/latest_index +1 -0
  330. data/features/data/gems/quick/latest_index.rz +0 -0
  331. data/features/data/gems/specs.4.8 +0 -0
  332. data/features/data/gems/specs.4.8.gz +0 -0
  333. data/features/data/gems/yaml +122 -0
  334. data/features/data/gems/yaml.Z +0 -0
  335. data/features/data/json_attribs/attribute_settings.json +3 -0
  336. data/features/data/json_attribs/json_runlist_and_attrs.json +4 -0
  337. data/features/data/myapp.bundle +0 -0
  338. data/features/data/node-load-test.rb +84 -0
  339. data/features/data/node-simple.rb +18 -0
  340. data/features/data/repositories/chef-repo/.gitignore +2 -0
  341. data/features/data/repositories/chef-repo/README.md +66 -0
  342. data/features/data/repositories/chef-repo/Rakefile +65 -0
  343. data/features/data/repositories/chef-repo/certificates/README.md +19 -0
  344. data/features/data/repositories/chef-repo/config/rake.rb +38 -0
  345. data/features/data/repositories/chef-repo/cookbooks/README.md +53 -0
  346. data/features/data/repositories/chef-repo/data_bags/README.md +23 -0
  347. data/features/data/repositories/chef-repo/roles/README.md +16 -0
  348. data/features/data/repositories/cookbooks/hosts/attributes/hosts.rb +1 -0
  349. data/features/data/repositories/cookbooks/hosts/cc.gemspec +36 -0
  350. data/features/data/repositories/cookbooks/hosts/metadata.json +41 -0
  351. data/features/data/repositories/cookbooks/hosts/metadata.rb +4 -0
  352. data/features/data/repositories/cookbooks/hosts/recipes/default.rb +6 -0
  353. data/features/data/repositories/cookbooks/hosts/templates/default/hosts.erb +27 -0
  354. data/features/data/search-tests/do_knife_search_test.rb +175 -0
  355. data/features/data/search-tests/search-test-nodes.rb +174 -0
  356. data/features/data/test_git_repo.tar.gz +0 -0
  357. data/features/file_steps.feature +70 -0
  358. data/features/files.feature +30 -16
  359. data/features/ssh.feature +2 -1
  360. data/features/ssh_steps.feature +20 -0
  361. data/features/step_definitions/cuken_steps.rb +10 -0
  362. data/features/support/env.rb +1 -0
  363. data/lib/cuken/api/chef.rb +115 -0
  364. data/lib/cuken/api/chef/common.rb +80 -0
  365. data/lib/cuken/api/file.rb +23 -3
  366. data/lib/cuken/chef.rb +3 -0
  367. data/lib/cuken/common.rb +0 -1
  368. data/lib/cuken/cucumber/chef.rb +16 -0
  369. data/lib/cuken/cucumber/chef/common.rb +68 -0
  370. data/lib/cuken/cucumber/chef/cookbook.rb +75 -0
  371. data/lib/cuken/cucumber/chef/cookbook_steps.rb +406 -0
  372. data/lib/cuken/cucumber/chef/deploy_steps.rb +84 -0
  373. data/lib/cuken/cucumber/chef/done_directory_steps.rb +41 -0
  374. data/lib/cuken/cucumber/chef/done_file_steps.rb +107 -0
  375. data/lib/cuken/cucumber/chef/done_knife_steps.rb +34 -0
  376. data/lib/cuken/cucumber/chef/fixture_steps.rb +413 -0
  377. data/lib/cuken/cucumber/chef/knife.rb +34 -0
  378. data/lib/cuken/cucumber/chef/node.rb +27 -0
  379. data/lib/cuken/cucumber/chef/node_steps.rb +88 -0
  380. data/lib/cuken/cucumber/chef/packages.rb +144 -0
  381. data/lib/cuken/cucumber/chef/pending_steps.rb +21 -0
  382. data/lib/cuken/cucumber/chef/recipe_steps.rb +23 -0
  383. data/lib/cuken/cucumber/chef/request_steps.rb +98 -0
  384. data/lib/cuken/cucumber/chef/response_steps.rb +233 -0
  385. data/lib/cuken/cucumber/chef/result_steps.rb +15 -0
  386. data/lib/cuken/cucumber/chef/run_client_steps.rb +260 -0
  387. data/lib/cuken/cucumber/chef/run_solo.rb +78 -0
  388. data/lib/cuken/cucumber/chef/sandbox_steps.rb +137 -0
  389. data/lib/cuken/cucumber/chef/search_steps.rb +70 -0
  390. data/lib/cuken/cucumber/chef/webrat_steps.rb +39 -0
  391. data/lib/cuken/cucumber/cmd.rb +18 -1
  392. data/lib/cuken/cucumber/common.rb +4 -0
  393. data/lib/cuken/cucumber/file.rb +25 -27
  394. data/lib/cuken/cucumber/ssh.rb +6 -6
  395. metadata +427 -27
  396. data/LICENSE.txt +0 -20
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Hedgehog (<hedgehogshiatus@gmail.com>)
3
+ # Copyright:: Copyright (c) 2011 Hedgehog.
4
+ # Portions of this work are derived from the Chef project
5
+ # The original license header follows:
6
+ #
7
+ # Copyright:: Copyright (c) 2008, 2010 Opscode, Inc.
8
+ # License:: Apache License, Version 2.0
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ #
22
+ Given /^the Knife file "([^"]*)"$/ do |path|
23
+ in_current_dir do
24
+ chef.client_knife_path = Pathname(path).expand_path.realdirpath
25
+ end
26
+ end
27
+
28
+ When /^I successfully run Knife's "([^"]*)"$/ do |cmd|
29
+ run_knife_command(cmd, true)
30
+ end
31
+
32
+ When /^I interactively run Knife's "([^"]*)"$/ do |cmd|
33
+ run_knife_command(cmd, true)
34
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ###
20
+ # Given
21
+ ###
22
+ Given /^a validated node$/ do
23
+ # client should have cached ohai assigned to it
24
+ client.register
25
+ client.build_node
26
+ client.node.run_list << "integration_setup"
27
+ end
@@ -0,0 +1,88 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ###
20
+ # Given
21
+ ###
22
+ Given /^a validated node$/ do
23
+ # client should have cached ohai assigned to it
24
+ client.register
25
+ client.build_node
26
+ client.node.run_list << "integration_setup"
27
+ end
28
+
29
+ Given /^a validated node in the 'cucumber' environment$/ do
30
+ # client should have cached ohai assigned to it
31
+ client.register
32
+ client.build_node
33
+ client.node.chef_environment("cucumber")
34
+ client.node.run_list << "integration_setup"
35
+ end
36
+
37
+ Given /^a validated node with an empty runlist$/ do
38
+ # client should have cached ohai assigned to it
39
+ client.register
40
+ client.build_node
41
+ end
42
+
43
+
44
+ Given /^it includes the recipe '([^\']+)'$/ do |recipe|
45
+ self.recipe = recipe
46
+ client.node.run_list << recipe
47
+ client.node.save
48
+ end
49
+
50
+ Given /^it includes the recipe '([^\']+)' at version '([^\']+)'$/ do |recipe, version|
51
+ self.recipe = "recipe[#{recipe},#{version}]"
52
+ client.node.run_list << "recipe[#{recipe}@#{version}]"
53
+ client.node.save
54
+ end
55
+
56
+ Given /^it includes no recipes$/ do
57
+ self.recipe = ""
58
+ client.node.run_list.reset!
59
+ client.node.save
60
+ end
61
+
62
+ Given /^it includes the role '([^\']+)'$/ do |role|
63
+ self.recipe = "role[#{role}]"
64
+ client.node.run_list << "role[#{role}]"
65
+ client.node.save
66
+ end
67
+
68
+ ###
69
+ # When
70
+ ###
71
+ When /^I remove '([^']*)' from the node's run list$/ do |run_list_item|
72
+ client.node.run_list.remove(run_list_item)
73
+ client.node.save
74
+ end
75
+
76
+ When /^I add '([^']*)' to the node's run list$/ do |run_list_item|
77
+ client.node.run_list << run_list_item
78
+ client.node.save
79
+ end
80
+
81
+
82
+ When /^the node is converged$/ do
83
+ client.run
84
+ end
85
+
86
+ When /^the node is retrieved from the API$/ do
87
+ self.inflated_response = Chef::Node.load(client.node.name)
88
+ end
@@ -0,0 +1,144 @@
1
+ def debian_compatible?
2
+ (ohai[:platform] == 'debian') || (ohai[:platform] == "ubuntu")
3
+ end
4
+
5
+ def chef_test_dpkg_installed?
6
+ shell_out("dpkg -l chef-integration-test").status.success?
7
+ end
8
+
9
+ def purge_chef_integration_debs
10
+ if debian_compatible? && chef_test_dpkg_installed?
11
+ shell_out!("dpkg -r chef-integration-test")
12
+ shell_out("dpkg --clear-avail")
13
+ end
14
+ end
15
+
16
+ Given /^I have configured my apt sources for integration tests$/ do
17
+ File.open("/etc/apt/sources.list.d/chef-integration-test.list", "w+") do |f|
18
+ f.puts "deb http://localhost:9000/ sid main"
19
+ end
20
+ end
21
+
22
+ def remove_integration_test_apt_source
23
+ FileUtils.rm("/etc/apt/sources.list.d/chef-integration-test.list")
24
+ rescue Errno::ENOENT
25
+ Chef::Log.info("Attempted to remove integration test from /etc/apt/sources.list.d but it didn't exist")
26
+ end
27
+
28
+ After("@apt") do
29
+ remove_integration_test_apt_source
30
+ purge_chef_integration_debs
31
+ shell_out! "apt-get clean" if debian_compatible?
32
+ end
33
+
34
+ Before('@dpkg') do
35
+ purge_chef_integration_debs if debian_compatible?
36
+ end
37
+
38
+ Before('@apt') do
39
+ purge_chef_integration_debs
40
+ shell_out!("apt-get clean") if debian_compatible?
41
+ end
42
+
43
+ After('@dpkg') do
44
+ purge_chef_integration_debs
45
+ end
46
+
47
+ Given "I am running on a debian compatible OS" do
48
+ unless debian_compatible?
49
+ pending("This test can only run on debian or ubuntu, but you have #{ohai[:platform]}")
50
+ end
51
+ end
52
+
53
+ Given "my dpkg architecture is 'amd64'" do
54
+ unless `dpkg --print-architecture`.strip == "amd64"
55
+ pending("This scenario can only run on an amd64 system")
56
+ end
57
+ end
58
+
59
+ Given "the deb package '$pkg_name' is available" do |pkg_name|
60
+ source = File.expand_path(File.dirname(__FILE__) + "/../data/apt/#{pkg_name}-1_amd64.deb")
61
+ dest = File.join(tmpdir, File.basename(source))
62
+ FileUtils.cp(source, dest)
63
+ end
64
+
65
+ Given "the apt server is running" do
66
+ self.apt_server_thread = Thread.new do
67
+ trap("INT") do
68
+ apt_server.shutdown
69
+ apt_server_thread.join
70
+ end
71
+
72
+ apt_server.start
73
+ end
74
+
75
+ Chef::Log.debug "Waiting for apt server to start"
76
+ until tcp_test_port("localhost", 9000) do
77
+ Chef::Log.debug "."
78
+ sleep 1
79
+ end
80
+ Chef::Log.debug "done"
81
+ end
82
+
83
+ Given "I have updated my apt cache" do
84
+ shell_out!("apt-get update")
85
+ end
86
+
87
+ Given /^the gems server is running$/ do
88
+ self.gemserver_thread = Thread.new do
89
+ trap("INT") do
90
+ gemserver.shutdown
91
+ gemserver_thread.join
92
+ end
93
+
94
+ gemserver.start
95
+ end
96
+ end
97
+
98
+ Given /^that I have the (.+) package system installed$/ do |package_system|
99
+ unless package_system_available?(package_system)
100
+ pending "This Cucumber feature will not execute, as it is missing the #{package_system} packaging system."
101
+ end
102
+ end
103
+
104
+ Then /^there should be a binary on the path called '(.+)'$/ do |binary_name|
105
+ binary_name.strip!
106
+ result = `which #{binary_name}`
107
+ result.should_not =~ /not found/
108
+ end
109
+
110
+ Then /^there should not be a binary on the path called '(.+)'$/ do |binary_name|
111
+ binary_name.strip!
112
+ result = `which #{binary_name}`.strip
113
+
114
+ unless result.empty?
115
+ result.should =~ /not found/
116
+ end
117
+ end
118
+
119
+ Then /^the gem '(.+)' version '(.+)' should be installed$/ do |gem_name, version|
120
+ Then "a file named 'installed-gems/gems/#{gem_name}-#{version}' should exist"
121
+ end
122
+
123
+ Then "the gem '$gem_name' version '$version' should not be installed" do |gem_name, version|
124
+ Then "a file named 'installed-gems/gems/#{gem_name}-#{version}' should not exist"
125
+ end
126
+
127
+ def dpkg_should_be_installed(pkg_name)
128
+ shell_out!("dpkg -l #{pkg_name}")
129
+ end
130
+
131
+ Then "the dpkg package '$package_name' should be installed" do |package_name|
132
+ dpkg_should_be_installed(package_name)
133
+ end
134
+
135
+ def tcp_test_port(hostname, port)
136
+ tcp_socket = TCPSocket.new(hostname, port)
137
+ true
138
+ rescue Errno::ETIMEDOUT
139
+ false
140
+ rescue Errno::ECONNREFUSED
141
+ false
142
+ ensure
143
+ tcp_socket && tcp_socket.close
144
+ end
@@ -0,0 +1,21 @@
1
+ #
2
+ # Author:: Christopher Walters (<cw@opscode.com>)
3
+ # Copyright:: Copyright (c) 2010 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ When "I haven't yet fixed CHEF-1816, this test should be pending" do
20
+ pending "CHEF-1816: Timestamp deploy provider rollback doesn't work"
21
+ end
@@ -0,0 +1,23 @@
1
+ Given /^the cookbook has a '(.+)' named '(.+)' in the '(.+)' specific directory$/ do |file_type, filename, specificity|
2
+ cookbook_name, recipe_name = recipe.split('::')
3
+ type_dir = file_type == 'file' ? 'files' : 'templates'
4
+ specific_dir = nil
5
+ case specificity
6
+ when "host"
7
+ specific_dir = "host-#{client.node[:fqdn]}"
8
+ when "platform-version"
9
+ specific_dir = "#{client.node[:platform]}-#{client.node[:platform_version]}"
10
+ when "platform"
11
+ specific_dir = client.node[:platform]
12
+ when "default"
13
+ specific_dir = "default"
14
+ end
15
+ new_file_dir = File.expand_path(File.dirname(__FILE__) + "/../data/cookbooks/#{cookbook_name}/#{type_dir}/#{specific_dir}")
16
+ cleanup_dirs << new_file_dir unless new_file_dir =~ /default$/
17
+ system("mkdir -p #{new_file_dir}")
18
+ new_file_name = File.join(new_file_dir, filename)
19
+ cleanup_files << new_file_name
20
+ new_file = File.open(new_file_name, "w")
21
+ new_file.puts(specificity)
22
+ new_file.close
23
+ end
@@ -0,0 +1,98 @@
1
+ Given /^I dump the contents of the search index$/ do
2
+ rest.get_rest("/search/").each do |index_name, index_url|
3
+ puts "INDEX NAME: `#{index_name}'"
4
+ pp rest.get_rest(index_url.sub("http://127.0.0.1:4000", ''))
5
+ end
6
+ end
7
+
8
+ When /^I '([^']*)' (?:to )?the path '([^']*)'$/ do |http_method, request_uri|
9
+ begin
10
+ self.api_response = rest.send("#{http_method}_rest".downcase.to_sym, request_uri)
11
+ self.inflated_response = self.api_response
12
+ rescue
13
+ Chef::Log.debug("Caught exception in request: #{$!.message}")
14
+ self.exception = $!
15
+ end
16
+ end
17
+
18
+ When /^I '(.+)' the path '(.+)' using a wrong private key$/ do |http_method, request_uri|
19
+ key = OpenSSL::PKey::RSA.generate(2048)
20
+ File.open(File.join(tmpdir, 'false_key.pem'), "w") { |f| f.print key }
21
+ @rest = Chef::REST.new(Chef::Config[:chef_server_url], 'snakebite' , File.join(tmpdir, 'false_key.pem'))
22
+
23
+ When "I '#{http_method}' the path '#{request_uri}'"
24
+ end
25
+
26
+ When /^I (.+) the client$/ do |action|
27
+ raise ArgumentError, "You can only create or save clients" unless action =~ /^(create|save)$/
28
+ client = stash['client']
29
+ request_body = {:name => client.name, :admin => client.admin}
30
+ begin
31
+ self.inflated_response = @rest.post_rest("clients", request_body) if action == 'create'
32
+ self.inflated_response = @rest.put_rest("clients/#{client.name}", request_body) if action == 'save'
33
+ rescue
34
+ self.exception = $!
35
+ end
36
+ end
37
+
38
+ When /^I '(.+)' the '(.+)' to the path '(.+)'$/ do |http_method, stash_key, request_uri|
39
+ begin
40
+ self.api_response = rest.send("#{http_method.to_s.downcase}_rest".downcase.to_sym, request_uri, stash[stash_key])
41
+ self.inflated_response = self.api_response
42
+ rescue
43
+ self.exception = $!
44
+ end
45
+ end
46
+
47
+ When /^I '(.+)' the '(.+)' to the path '(.+)' using a wrong private key$/ do |http_method, stash_key, request_uri|
48
+ key = OpenSSL::PKey::RSA.generate(2048)
49
+ File.open(File.join(tmpdir, 'false_key.pem'), "w") { |f| f.print key }
50
+ @rest = Chef::REST.new(Chef::Config[:chef_server_url], 'snakebite' , File.join(tmpdir, 'false_key.pem'))
51
+
52
+ When "I '#{http_method}' the '#{stash_key}' to the path '#{request_uri}'"
53
+ end
54
+
55
+ When /^I delete local private key/ do
56
+ Chef::FileCache.delete("private_key.pem")
57
+ end
58
+
59
+ When /^I register '(.+)'$/ do |user|
60
+ begin
61
+ rest = Chef::REST.new(Chef::Config[:registration_url])
62
+ rest.register("bobo")
63
+ rescue
64
+ self.exception = $!
65
+ end
66
+ end
67
+
68
+ When /^I authenticate as '(.+)'$/ do |reg|
69
+ begin
70
+ rest.authenticate(reg, 'tclown')
71
+ rescue
72
+ self.exception = $!
73
+ end
74
+ end
75
+
76
+ When "I edit the '$not_admin' client" do |client|
77
+ stash['client'] = @rest.get_rest("/clients/not_admin")
78
+ end
79
+
80
+ When "I set '$property' to true" do |property|
81
+ stash['client'].send(property.to_sym, true)
82
+ end
83
+
84
+ def call_as_admin(&block)
85
+ orig_rest = @rest
86
+ orig_node_name = Chef::Config[:node_name]
87
+ orig_client_key = Chef::Config[:client_key]
88
+ begin
89
+ @rest = admin_rest
90
+ Chef::Config[:node_name] = @rest.auth_credentials.client_name
91
+ Chef::Config[:client_key] = @rest.auth_credentials.key_file
92
+ yield
93
+ ensure
94
+ @rest = orig_rest
95
+ Chef::Config[:node_name] = orig_node_name
96
+ Chef::Config[:client_key] = orig_client_key
97
+ end
98
+ end
@@ -0,0 +1,233 @@
1
+
2
+ # Walk array/hash to determine maximum depth. A scalar (anything but an
3
+ # Array or Hash) has depth 0.
4
+ def count_structure_levels(obj)
5
+ if obj.respond_to?(:keys)
6
+ # empty hash also has depth 0.
7
+ max_depth = 0
8
+ obj.keys.each do |key|
9
+ child_levels = 1 + count_structure_levels(obj[key])
10
+ max_depth = [max_depth, child_levels].max
11
+ end
12
+ max_depth
13
+ elsif obj.is_a?(Array)
14
+ # empty array also has depth 0.
15
+ max_depth = 0
16
+ obj.each do |child|
17
+ child_levels = 1 + count_structure_levels(child)
18
+ max_depth = [max_depth, child_levels].max
19
+ end
20
+ max_depth
21
+ else
22
+ 0
23
+ end
24
+ end
25
+
26
+ Then /^I should get a '(.+)' exception$/ do |exception|
27
+ self.exception.message.to_s.should == exception
28
+ end
29
+
30
+ Then /^I should not get an exception$/ do
31
+ self.exception.should == nil
32
+ end
33
+
34
+ Then /^the response code should be '(.+)'$/ do |response_code|
35
+ case response_code.to_i
36
+ when 200
37
+ self.api_response.code.should == 200
38
+ when 400
39
+ self.exception.to_s.should match(/(Bad Request|400)/)
40
+ when 404
41
+ Then "I should get a 'RestClient::ResourceNotFound' exception"
42
+ when 412
43
+ self.exception.to_s.should match(/(Precondition Failed|412)/)
44
+ end
45
+ end
46
+
47
+ Then /^the response exception body should match '(.+)'/ do |regex|
48
+ raise "last response wasn't exception" unless self.exception
49
+ raise "last response exception had no body" unless self.exception.response && self.exception.response.body
50
+
51
+ self.exception.response.body.should =~ /#{regex}/m
52
+ end
53
+
54
+ Then /^the inflated responses key '(.+)' should be the integer '(\d+)'$/ do |key, int|
55
+ inflated_response[key].should == int.to_i
56
+ end
57
+
58
+ Then /^the inflated responses key '(\w+)' should match '(.+)'$/ do |key, regex|
59
+ puts self.inflated_response.inspect if ENV['DEBUG']
60
+ self.inflated_response[key].should =~ /#{regex}/m
61
+ end
62
+
63
+ Then /^the inflated responses key '(.+)' should be literally '(.+)'$/ do |key, literal|
64
+ puts self.inflated_response.inspect if ENV['DEBUG']
65
+ to_check = case literal
66
+ when "true"
67
+ true
68
+ when "false"
69
+ false
70
+ end
71
+
72
+ self.inflated_response[key].should == to_check
73
+ end
74
+
75
+ Then /^the inflated response should match '(.+)' as json$/ do |regex|
76
+ puts self.inflated_response.inspect if ENV["DEBUG"]
77
+ Chef::JSONCompat.to_json(self.inflated_response).should =~ /#{regex}/m
78
+ end
79
+
80
+ Then /^the inflated responses key '(.+)' should match '(.+)' as json$/ do |key, regex|
81
+ puts self.inflated_response.inspect if ENV["DEBUG"]
82
+ Chef::JSONCompat.to_json(self.inflated_response[key]).should =~ /#{regex}/m
83
+ end
84
+
85
+ Then /^the inflated responses key '(.+)' item '(\d+)' should be '(.+)'$/ do |key, index, to_equal|
86
+ inflated_response[key][index.to_i].should == to_equal
87
+ end
88
+
89
+ Then /^the inflated responses key '(.+)' item '(\d+)' should be a kind of '(.+)'$/ do |key, index, constant|
90
+ inflated_response[key][index.to_i].should be_a_kind_of(eval(constant))
91
+ end
92
+
93
+ Then /^the inflated responses key '(.+)' item '(\d+)' key '(.+)' should be '(.+)'$/ do |key, index, sub_key, to_equal|
94
+ inflated_response[key][index.to_i][sub_key].should == to_equal
95
+ end
96
+
97
+ Then /^the inflated responses key '(.+)' item '(\d+)' should respond to '(.+)' with '(.*)'$/ do |key, index, method_name, method_value|
98
+ inflated_response[key][index.to_i].send(method_name.to_sym).should == method_value
99
+ end
100
+
101
+ Then /^the inflated responses key '(.+)' sub-key '(.+)' should be an empty hash$/ do |key, sub_key|
102
+ inflated_response[key][sub_key].should == {}
103
+ end
104
+
105
+ Then /^the inflated responses key '(\w+)' sub-key '(\w+)' should match '(.+)'$/ do |key, sub_key, regex|
106
+ inflated_response[key][sub_key].should =~ /#{regex}/m
107
+ end
108
+
109
+ Then /^the inflated responses key '(\w+)' sub-key '(\w+)' item '(\d+)' sub-key '(\w+)' should match '(.+)'$/ do |key, sub_key, index, second_sub_key, regex|
110
+ inflated_response[key][sub_key][index.to_i][second_sub_key].should =~ /#{regex}/m
111
+ end
112
+
113
+ Then /^the inflated responses key '(\w+)' sub-key '(\w+)' item '(\d+)' sub-key '(\w+)' should equal '(.+)'$/ do |key, sub_key, index, second_sub_key, equal|
114
+ inflated_response[key][sub_key][index.to_i][second_sub_key].should == equal
115
+ end
116
+
117
+ Then /^the inflated responses key '(\w+)' sub-key '(\w+)' should be '(\d+)' items long$/ do |key, sub_key, length|
118
+ inflated_response[key][sub_key].length.should == length.to_i
119
+ end
120
+
121
+ Then /^the inflated responses key '(\w+)' should be '(\d+)' items long$/ do |key, length|
122
+ inflated_response[key].length.should == length.to_i
123
+ end
124
+
125
+ Then /^the inflated responses key '(.+)' should not exist$/ do |key|
126
+ self.inflated_response.has_key?(key).should == false
127
+ end
128
+
129
+ Then /^the inflated responses key '(.+)' should exist$/ do |key|
130
+ self.inflated_response.has_key?(key).should == true
131
+ end
132
+
133
+ Then /^the inflated responses key '(.+)'.to_s should be '(.+)'$/ do |key, expected_value|
134
+ self.inflated_response[key].to_s.should == expected_value
135
+ end
136
+
137
+ Then /^the inflated response should be an empty array$/ do
138
+ self.inflated_response.should == []
139
+ end
140
+
141
+ Then /^the inflated response should be an empty hash$/ do
142
+ self.inflated_response.should == {}
143
+ end
144
+
145
+ Then /^the inflated response should include '(.+)'$/ do |entry|
146
+ if inflated_response.size == 1
147
+ Array(inflated_response).first.should match(/#{entry}/)
148
+ else
149
+ inflated_response.detect { |n| n =~ /#{entry}/ }.should_not be_empty
150
+ end
151
+ end
152
+
153
+ Then /^the inflated response should be '(.+)' items long$/ do |length|
154
+ if length.respond_to?(:keys)
155
+ self.inflated_response.keys.length.should == length.to_i
156
+ else
157
+ self.inflated_response.length.should == length.to_i
158
+ end
159
+ end
160
+
161
+ Then /^the '(.+)' header should match '(.+)'$/ do |header, regex|
162
+ self.api_response.headers[header].should =~ /#{regex}/
163
+ end
164
+
165
+ Then /^the inflated responses key '(.+)' should include '(.+)'$/ do |key, regex|
166
+ if self.inflated_response[key].size == 1
167
+ self.inflated_response[key].first.should match(/#{regex}/)
168
+ else
169
+ self.inflated_response[key].detect { |n| n =~ /#{regex}/ }.should_not be_empty
170
+ end
171
+ end
172
+
173
+ Then /^the inflated response should match the '(.+)'$/ do |stash_name|
174
+ stash[stash_name].each do |k,v|
175
+ self.inflated_response[k.to_s].should == v
176
+ end
177
+ end
178
+
179
+ Then /^the inflated response should be the '(.+)'$/ do |stash_key|
180
+ self.inflated_response.should == stash[stash_key]
181
+ end
182
+
183
+ Then /^the stringified response should be the stringified '(.+)'$/ do |stash_key|
184
+ self.api_response.to_s.should == stash[stash_key].to_s
185
+ end
186
+
187
+ Then /^the inflated response should be a kind of '(.+)'$/ do |thing|
188
+ self.inflated_response.should be_a_kind_of(eval(thing))
189
+ end
190
+
191
+ Then "the inflated response should equal '$code'" do |code|
192
+ # cucumber can suck it, I'm using real code.
193
+ expected = eval(code)
194
+ inflated_response.should == expected
195
+ end
196
+
197
+ Then /^the inflated response should respond to '(.+)' with '(.+)'$/ do |method, to_match|
198
+ to_match = Chef::JSONCompat.from_json(to_match) if to_match =~ /^\[|\{/
199
+ to_match = true if to_match == 'true'
200
+ to_match = false if to_match == 'false'
201
+ self.inflated_response.to_hash[method].should == to_match
202
+ end
203
+
204
+ Then /^the inflated response should respond to '(.+)' and match '(.+)'$/ do |method, to_match|
205
+ self.inflated_response.to_hash[method].should == to_match
206
+ end
207
+
208
+ Then /^the inflated response should respond to '(.+)' and match '(.+)' as json$/ do |method, regex|
209
+ Chef::JSONCompat.to_json(self.inflated_response.to_hash[method]).should =~ /#{regex}/m
210
+ end
211
+
212
+ #And the 'deep_array' component has depth of '50' levels
213
+ Then /^the '(.+)' component has depth of '(.+)' levels$/ do |method, levels|
214
+ count_structure_levels(self.inflated_response.to_hash[method]).should == levels.to_i
215
+ end
216
+
217
+ Then /^the fields in the inflated response should match the '(.+)'$/ do |stash_name|
218
+ self.inflated_response.each do |k,v|
219
+ unless k =~ /^_/ || k == 'couchrest-type'
220
+ stash[stash_name][k.to_sym].should == v
221
+ end
222
+ end
223
+ end
224
+
225
+ Then /^the data_bag named '(.+)' should not have an item named '(.+)'$/ do |data_bag, item|
226
+ exists = true
227
+ begin
228
+ Chef::DataBagItem.load(data_bag, item, @couchdb)
229
+ rescue
230
+ exists = false
231
+ end
232
+ exists.should == false
233
+ end