poolparty 0.2.69 → 0.2.84

Sign up to get free protection for your applications and to get access to all the features.
Files changed (298) hide show
  1. data/Capfile +1 -0
  2. data/History.txt +6 -0
  3. data/Manifest.txt +140 -143
  4. data/PostInstall.txt +1 -1
  5. data/README.txt +2 -0
  6. data/bin/cloud-configure +5 -2
  7. data/bin/cloud-handle-load +3 -3
  8. data/bin/cloud-maintain +3 -3
  9. data/bin/cloud-provision +6 -5
  10. data/bin/cloud-rsync +28 -0
  11. data/bin/cloud-setup-dev +25 -0
  12. data/bin/cloud-spec +40 -0
  13. data/bin/cloud-start +5 -3
  14. data/bin/server-clean-cert-for +15 -0
  15. data/bin/server-rerun +0 -1
  16. data/bin/server-start-client +1 -1
  17. data/bin/server-start-master +1 -1
  18. data/bin/server-start-node +1 -1
  19. data/bin/server-update-hosts +4 -3
  20. data/bin/server-write-new-nodes +26 -0
  21. data/generators/poolspec/USAGE +2 -2
  22. data/generators/poolspec/poolspec_generator.rb +1 -1
  23. data/lib/erlang/messenger/Makefile +15 -0
  24. data/lib/erlang/messenger/ebin/client_app.beam +0 -0
  25. data/lib/erlang/messenger/ebin/client_server.beam +0 -0
  26. data/lib/erlang/messenger/ebin/erl_crash.dump +10326 -0
  27. data/lib/erlang/messenger/ebin/master_app.beam +0 -0
  28. data/lib/erlang/messenger/ebin/node_app.beam +0 -0
  29. data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
  30. data/lib/erlang/messenger/ebin/pm_client_old.beam +0 -0
  31. data/lib/erlang/messenger/ebin/pm_client_supervisor.beam +0 -0
  32. data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
  33. data/lib/erlang/messenger/ebin/pm_event_manager.beam +0 -0
  34. data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
  35. data/lib/erlang/messenger/ebin/pm_master_event_handler.beam +0 -0
  36. data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
  37. data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
  38. data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
  39. data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
  40. data/lib/erlang/messenger/ebin/pm_spawner.beam +0 -0
  41. data/lib/erlang/messenger/ebin/pm_strings.beam +0 -0
  42. data/lib/erlang/messenger/ebin/utils.beam +0 -0
  43. data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
  44. data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
  45. data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
  46. data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
  47. data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
  48. data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
  49. data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
  50. data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
  51. data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
  52. data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
  53. data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
  54. data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
  55. data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
  56. data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
  57. data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
  58. data/lib/erlang/messenger/lib/eunit/src/Makefile +46 -0
  59. data/lib/erlang/messenger/src/pm_master.erl +5 -0
  60. data/lib/erlang/messenger/src/pm_node.erl +2 -3
  61. data/lib/erlang/messenger/src/pm_spawner.erl +213 -0
  62. data/lib/poolparty/base_packages/heartbeat.rb +57 -43
  63. data/lib/poolparty/base_packages/poolparty.rb +18 -15
  64. data/lib/poolparty/capistrano.rb +18 -0
  65. data/lib/poolparty/core/class.rb +24 -0
  66. data/lib/poolparty/core/kernel.rb +7 -0
  67. data/lib/poolparty/core/module.rb +2 -2
  68. data/lib/poolparty/core/string.rb +1 -1
  69. data/lib/poolparty/dependency_resolutions/puppet.rb +10 -2
  70. data/lib/poolparty/exceptions/ProvisionerException.rb +5 -0
  71. data/lib/poolparty/extra/deployments.rb +31 -0
  72. data/lib/poolparty/helpers/binary.rb +14 -2
  73. data/lib/poolparty/helpers/optioner.rb +61 -22
  74. data/lib/poolparty/helpers/ruberl.rb +33 -0
  75. data/lib/poolparty/modules/cloud_dsl.rb +2 -1
  76. data/lib/poolparty/modules/cloud_resourcer.rb +30 -6
  77. data/lib/poolparty/modules/configurable.rb +2 -0
  78. data/lib/poolparty/modules/file_writer.rb +4 -4
  79. data/lib/poolparty/modules/resourcing_dsl.rb +5 -5
  80. data/lib/poolparty/monitors/base_monitor.rb +1 -1
  81. data/lib/poolparty/monitors/monitors/cpu_monitor.rb +2 -2
  82. data/lib/poolparty/net/messenger.rb +1 -1
  83. data/lib/poolparty/net/remote.rb +2 -2
  84. data/lib/poolparty/net/remote_bases/ec2.rb +51 -11
  85. data/lib/poolparty/net/remote_instance.rb +7 -3
  86. data/lib/poolparty/net/remoter.rb +72 -24
  87. data/lib/poolparty/net/remoter_base.rb +10 -0
  88. data/lib/poolparty/plugins/deploydirectory.rb +10 -5
  89. data/lib/poolparty/plugins/git.rb +51 -0
  90. data/lib/poolparty/{pool → poolparty}/base.rb +4 -2
  91. data/lib/poolparty/{pool → poolparty}/cloud.rb +32 -10
  92. data/lib/poolparty/{pool → poolparty}/plugin_model.rb +4 -4
  93. data/lib/poolparty/{pool → poolparty}/pool.rb +2 -2
  94. data/lib/poolparty/{pool → poolparty}/resource.rb +33 -15
  95. data/lib/poolparty/{pool → poolparty}/resources/class_package.rb +3 -3
  96. data/lib/poolparty/{pool → poolparty}/resources/directory.rb +6 -3
  97. data/lib/poolparty/{pool → poolparty}/resources/exec.rb +2 -5
  98. data/lib/poolparty/{pool → poolparty}/resources/file.rb +3 -3
  99. data/lib/poolparty/{pool → poolparty}/resources/package.rb +1 -1
  100. data/lib/poolparty/{pool → poolparty}/resources/remote_file.rb +1 -1
  101. data/lib/poolparty/poolparty/resources/remote_user.rb +17 -0
  102. data/lib/poolparty/{pool → poolparty}/resources/sshkey.rb +5 -1
  103. data/lib/poolparty/{pool → poolparty}/script.rb +1 -1
  104. data/lib/poolparty/provisioners/capistrano/capistrano.rb +127 -0
  105. data/lib/poolparty/provisioners/capistrano/capistrano_configurer.rb +58 -0
  106. data/lib/poolparty/provisioners/capistrano/recipies/base.rb +104 -0
  107. data/lib/poolparty/provisioners/capistrano/recipies/master.rb +121 -0
  108. data/lib/poolparty/provisioners/capistrano/recipies/slave.rb +12 -0
  109. data/lib/poolparty/provisioners/provisioner_base.rb +204 -0
  110. data/lib/poolparty/spec/core/string.rb +16 -0
  111. data/lib/poolparty/spec/matchers/a_spec_extensions_base.rb +26 -0
  112. data/lib/poolparty/spec/matchers/have_cron.rb +28 -0
  113. data/lib/poolparty/spec/matchers/have_deploydirectory.rb +15 -0
  114. data/lib/poolparty/spec/matchers/have_directory.rb +31 -0
  115. data/lib/poolparty/spec/matchers/have_exec.rb +28 -0
  116. data/lib/poolparty/spec/matchers/have_file.rb +28 -0
  117. data/lib/poolparty/spec/matchers/have_gempackage.rb +28 -0
  118. data/lib/poolparty/spec/matchers/have_git.rb +28 -0
  119. data/lib/poolparty/spec/matchers/have_host.rb +28 -0
  120. data/lib/poolparty/spec/matchers/have_mount.rb +28 -0
  121. data/lib/poolparty/spec/matchers/have_package.rb +28 -0
  122. data/lib/poolparty/spec/matchers/have_remotefile.rb +28 -0
  123. data/lib/poolparty/spec/matchers/have_rsyncmirror.rb +28 -0
  124. data/lib/poolparty/spec/matchers/have_service.rb +28 -0
  125. data/lib/poolparty/spec/matchers/have_sshkey.rb +28 -0
  126. data/lib/poolparty/spec/matchers/have_symlink.rb +28 -0
  127. data/lib/poolparty/spec/matchers/have_variable.rb +32 -0
  128. data/lib/poolparty/spec/spec/dynamic_matchers.rb +63 -0
  129. data/lib/poolparty/spec/spec/ensure_matchers_exist.rb +7 -0
  130. data/lib/poolparty/spec/templates/have_base.rb +28 -0
  131. data/lib/poolparty/templates/authkeys +1 -1
  132. data/lib/poolparty/templates/gem +12 -10
  133. data/lib/poolparty/templates/ha.cf +9 -11
  134. data/lib/poolparty/templates/haresources +1 -1
  135. data/lib/poolparty/templates/logd.cf +42 -0
  136. data/lib/poolparty/templates/puppet.conf +18 -8
  137. data/lib/poolparty/templates/puppetcleaner +9 -3
  138. data/lib/poolparty/templates/puppetrerun +16 -3
  139. data/lib/poolparty/templates/puppetrunner +1 -1
  140. data/lib/poolparty/version.rb +1 -1
  141. data/lib/poolparty.rb +12 -8
  142. data/lib/poolpartyspec.rb +34 -0
  143. data/poolparty.gemspec +151 -149
  144. data/spec/poolparty/aska/aska_spec.rb +0 -5
  145. data/spec/poolparty/bin/console_spec.rb +3 -0
  146. data/spec/poolparty/extra/deployments_spec.rb +64 -0
  147. data/spec/poolparty/helpers/binary_spec.rb +1 -1
  148. data/spec/poolparty/helpers/optioner_spec.rb +17 -4
  149. data/spec/poolparty/modules/cloud_resourcer_spec.rb +19 -2
  150. data/spec/poolparty/modules/configurable_spec.rb +2 -2
  151. data/spec/poolparty/net/remote_bases/ec2_spec.rb +5 -2
  152. data/spec/poolparty/net/remote_instance_spec.rb +5 -0
  153. data/spec/poolparty/net/remote_spec.rb +24 -31
  154. data/spec/poolparty/net/remoter_base_spec.rb +11 -6
  155. data/spec/poolparty/net/remoter_spec.rb +55 -27
  156. data/spec/poolparty/plugins/deploydirectory_spec.rb +1 -0
  157. data/spec/poolparty/plugins/git_spec.rb +45 -0
  158. data/spec/poolparty/{pool → poolparty}/cloud_spec.rb +41 -0
  159. data/spec/poolparty/{pool → poolparty}/plugin_spec.rb +1 -1
  160. data/spec/poolparty/{pool → poolparty}/pool_spec.rb +1 -1
  161. data/spec/poolparty/{pool → poolparty}/resource_spec.rb +15 -2
  162. data/spec/poolparty/poolparty/resources/user_spec.rb +38 -0
  163. data/spec/poolparty/poolparty/test_plugins/virtual_host_template.erb +0 -0
  164. data/spec/poolparty/poolparty_spec.rb +1 -1
  165. data/spec/poolparty/provisioners/capistrano/capistrano_spec.rb +27 -0
  166. data/spec/poolparty/provisioners/provisioner_base_spec.rb +120 -0
  167. data/spec/poolparty/spec/core/string_spec.rb +57 -0
  168. data/spec/poolparty/spec_helper.rb +48 -6
  169. data/tasks/deployment.rake +3 -5
  170. data/tasks/spec.rake +2 -3
  171. data/website/index.html +2 -2
  172. metadata +150 -148
  173. data/lib/erlang/messenger/lib/eunit/.svn/all-wcprops +0 -53
  174. data/lib/erlang/messenger/lib/eunit/.svn/entries +0 -140
  175. data/lib/erlang/messenger/lib/eunit/.svn/format +0 -1
  176. data/lib/erlang/messenger/lib/eunit/.svn/prop-base/NOTES.svn-base +0 -5
  177. data/lib/erlang/messenger/lib/eunit/.svn/text-base/AUTHORS.svn-base +0 -2
  178. data/lib/erlang/messenger/lib/eunit/.svn/text-base/CHANGELOG.svn-base +0 -14
  179. data/lib/erlang/messenger/lib/eunit/.svn/text-base/COPYING.svn-base +0 -504
  180. data/lib/erlang/messenger/lib/eunit/.svn/text-base/NOTES.svn-base +0 -276
  181. data/lib/erlang/messenger/lib/eunit/.svn/text-base/README.svn-base +0 -3
  182. data/lib/erlang/messenger/lib/eunit/.svn/text-base/sys.config.svn-base +0 -9
  183. data/lib/erlang/messenger/lib/eunit/.svn/text-base/vsn.mk.svn-base +0 -1
  184. data/lib/erlang/messenger/lib/eunit/doc/.svn/all-wcprops +0 -59
  185. data/lib/erlang/messenger/lib/eunit/doc/.svn/entries +0 -142
  186. data/lib/erlang/messenger/lib/eunit/doc/.svn/format +0 -1
  187. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/erlang.png.svn-base +0 -5
  188. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/eunit.html.svn-base +0 -5
  189. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/index.html.svn-base +0 -5
  190. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/modules-frame.html.svn-base +0 -5
  191. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/overview-summary.html.svn-base +0 -5
  192. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/packages-frame.html.svn-base +0 -5
  193. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/edoc-info.svn-base +0 -3
  194. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/erlang.png.svn-base +0 -0
  195. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/eunit.html.svn-base +0 -172
  196. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/index.html.svn-base +0 -17
  197. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/modules-frame.html.svn-base +0 -12
  198. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview-summary.html.svn-base +0 -984
  199. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview.edoc.svn-base +0 -980
  200. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/packages-frame.html.svn-base +0 -11
  201. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/stylesheet.css.svn-base +0 -55
  202. data/lib/erlang/messenger/lib/eunit/ebin/.svn/all-wcprops +0 -5
  203. data/lib/erlang/messenger/lib/eunit/ebin/.svn/dir-prop-base +0 -8
  204. data/lib/erlang/messenger/lib/eunit/ebin/.svn/entries +0 -28
  205. data/lib/erlang/messenger/lib/eunit/ebin/.svn/format +0 -1
  206. data/lib/erlang/messenger/lib/eunit/examples/.svn/all-wcprops +0 -23
  207. data/lib/erlang/messenger/lib/eunit/examples/.svn/entries +0 -66
  208. data/lib/erlang/messenger/lib/eunit/examples/.svn/format +0 -1
  209. data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/eunit_examples.erl.svn-base +0 -5
  210. data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/fib.erl.svn-base +0 -5
  211. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/eunit_examples.erl.svn-base +0 -339
  212. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/fib.erl.svn-base +0 -19
  213. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/tests.txt.svn-base +0 -1
  214. data/lib/erlang/messenger/lib/eunit/include/.svn/all-wcprops +0 -11
  215. data/lib/erlang/messenger/lib/eunit/include/.svn/entries +0 -41
  216. data/lib/erlang/messenger/lib/eunit/include/.svn/format +0 -1
  217. data/lib/erlang/messenger/lib/eunit/include/.svn/prop-base/eunit.hrl.svn-base +0 -5
  218. data/lib/erlang/messenger/lib/eunit/include/.svn/text-base/eunit.hrl.svn-base +0 -313
  219. data/lib/erlang/messenger/lib/eunit/src/.svn/all-wcprops +0 -113
  220. data/lib/erlang/messenger/lib/eunit/src/.svn/entries +0 -259
  221. data/lib/erlang/messenger/lib/eunit/src/.svn/format +0 -1
  222. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/autoload.erl.svn-base +0 -5
  223. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/code_monitor.erl.svn-base +0 -5
  224. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit.erl.svn-base +0 -5
  225. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_autoexport.erl.svn-base +0 -5
  226. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_data.erl.svn-base +0 -5
  227. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_internal.hrl.svn-base +0 -5
  228. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_lib.erl.svn-base +0 -5
  229. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_proc.erl.svn-base +0 -5
  230. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_serial.erl.svn-base +0 -5
  231. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_server.erl.svn-base +0 -5
  232. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_striptests.erl.svn-base +0 -5
  233. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_test.erl.svn-base +0 -5
  234. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tests.erl.svn-base +0 -5
  235. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tty.erl.svn-base +0 -5
  236. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/file_monitor.erl.svn-base +0 -5
  237. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/autoload.erl.svn-base +0 -388
  238. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/code_monitor.erl.svn-base +0 -243
  239. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.app.src.svn-base +0 -21
  240. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.appup.src.svn-base +0 -1
  241. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.erl.svn-base +0 -196
  242. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_autoexport.erl.svn-base +0 -102
  243. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_data.erl.svn-base +0 -798
  244. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_internal.hrl.svn-base +0 -48
  245. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_lib.erl.svn-base +0 -682
  246. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_proc.erl.svn-base +0 -552
  247. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_serial.erl.svn-base +0 -157
  248. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_server.erl.svn-base +0 -340
  249. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_striptests.erl.svn-base +0 -64
  250. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_test.erl.svn-base +0 -334
  251. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tests.erl.svn-base +0 -45
  252. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tty.erl.svn-base +0 -272
  253. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/file_monitor.erl.svn-base +0 -409
  254. data/lib/erlang/messenger/src/pm_client_old.erl +0 -52
  255. data/lib/poolparty/helpers/provisioner_base.rb +0 -346
  256. data/lib/poolparty/helpers/provisioners/master.rb +0 -205
  257. data/lib/poolparty/helpers/provisioners/slave.rb +0 -64
  258. data/spec/poolparty/helpers/provisioner_base_spec.rb +0 -134
  259. data/spec/poolparty/helpers/provisioners/master_spec.rb +0 -54
  260. data/spec/poolparty/helpers/provisioners/slave_spec.rb +0 -28
  261. /data/lib/poolparty/{pool → poolparty}/custom_resource.rb +0 -0
  262. /data/lib/poolparty/{pool → poolparty}/loggable.rb +0 -0
  263. /data/lib/poolparty/{pool → poolparty}/plugin.rb +0 -0
  264. /data/lib/poolparty/{pool → poolparty}/resources/conditional.rb +0 -0
  265. /data/lib/poolparty/{pool → poolparty}/resources/cron.rb +0 -0
  266. /data/lib/poolparty/{pool → poolparty}/resources/custom_service.rb +0 -0
  267. /data/lib/poolparty/{pool → poolparty}/resources/gem_package.rb +0 -0
  268. /data/lib/poolparty/{pool → poolparty}/resources/host.rb +0 -0
  269. /data/lib/poolparty/{pool → poolparty}/resources/mount.rb +0 -0
  270. /data/lib/poolparty/{pool → poolparty}/resources/service.rb +0 -0
  271. /data/lib/poolparty/{pool → poolparty}/resources/symlink.rb +0 -0
  272. /data/lib/poolparty/{pool → poolparty}/resources/variable.rb +0 -0
  273. /data/log/{pool.logs → pool.log} +0 -0
  274. /data/spec/poolparty/{pool/test_plugins/virtual_host_template.erb → net/log/pool.log} +0 -0
  275. /data/spec/poolparty/{pool → poolparty}/base_spec.rb +0 -0
  276. /data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_basic.rb +0 -0
  277. /data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_plugins.rb +0 -0
  278. /data/spec/poolparty/{pool → poolparty}/configurers/ruby_spec.rb +0 -0
  279. /data/spec/poolparty/{pool → poolparty}/custom_resource_spec.rb +0 -0
  280. /data/spec/poolparty/{pool → poolparty}/example_spec.rb +0 -0
  281. /data/spec/poolparty/{pool → poolparty}/plugin_model_spec.rb +0 -0
  282. /data/spec/poolparty/{pool → poolparty}/resources/class_package_spec.rb +0 -0
  283. /data/spec/poolparty/{pool → poolparty}/resources/conditional_spec.rb +0 -0
  284. /data/spec/poolparty/{pool → poolparty}/resources/cron_spec.rb +0 -0
  285. /data/spec/poolparty/{pool → poolparty}/resources/directory_spec.rb +0 -0
  286. /data/spec/poolparty/{pool → poolparty}/resources/exec_spec.rb +0 -0
  287. /data/spec/poolparty/{pool → poolparty}/resources/file_spec.rb +0 -0
  288. /data/spec/poolparty/{pool → poolparty}/resources/gem_spec.rb +0 -0
  289. /data/spec/poolparty/{pool → poolparty}/resources/host_spec.rb +0 -0
  290. /data/spec/poolparty/{pool → poolparty}/resources/package_spec.rb +0 -0
  291. /data/spec/poolparty/{pool → poolparty}/resources/remote_file_spec.rb +0 -0
  292. /data/spec/poolparty/{pool → poolparty}/resources/service_spec.rb +0 -0
  293. /data/spec/poolparty/{pool → poolparty}/resources/sshkey_spec.rb +0 -0
  294. /data/spec/poolparty/{pool → poolparty}/resources/symlink_spec.rb +0 -0
  295. /data/spec/poolparty/{pool → poolparty}/resources/variable_spec.rb +0 -0
  296. /data/spec/poolparty/{pool → poolparty}/script_spec.rb +0 -0
  297. /data/spec/poolparty/{pool → poolparty}/test_plugins/sshkey_test +0 -0
  298. /data/spec/poolparty/{pool → poolparty}/test_plugins/webserver.rb +0 -0
@@ -2,7 +2,11 @@ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  class ResourcerTestClass
4
4
  include CloudResourcer
5
- include Configurable
5
+ include Configurable
6
+
7
+ default_options({
8
+ :minimum_runtime => 50.minutes
9
+ })
6
10
 
7
11
  def initialize(&block)
8
12
  store_block(&block) if block
@@ -35,10 +39,23 @@ describe "CloudResourcer" do
35
39
  @tc.instances 4..10
36
40
  @tc.minimum_instances.should == 4
37
41
  end
38
- it "should set the max to the maximum instances to the last" do
42
+ it "should be able to accept a Fixnum and set the minimum_instances and maximum_instances" do
43
+ @tc.instances 1
44
+ @tc.minimum_instances.should == 1
45
+ @tc.maximum_instances.should == 1
46
+ end
47
+ it "should set the max to the maximum instances to the last in a given range" do
39
48
  @tc.instances 4..10
40
49
  @tc.maximum_instances.should == 10
41
50
  end
51
+ it "should have default minimum_runtime of 50 minutes (3000 seconds)" do
52
+ Base.stub!(:minimum_runtime).and_return 50.minutes
53
+ @tc.minimum_runtime.should == 50.minutes
54
+ end
55
+ it "should have minimum_runtime" do
56
+ @tc.minimum_runtime 40.minutes
57
+ @tc.minimum_runtime.should == 40.minutes
58
+ end
42
59
  describe "keypair_path" do
43
60
  before(:each) do
44
61
  end
@@ -1,12 +1,12 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
- class TestClass
3
+ class TestClass2
4
4
  include Configurable
5
5
  end
6
6
 
7
7
  describe "configurable" do
8
8
  before(:each) do
9
- @tc = TestClass.new
9
+ @tc = TestClass2.new
10
10
  end
11
11
  it "should set the name as frank" do
12
12
  @tc.configure({:name => "frank"})
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
3
  # include Remote
4
4
 
5
- class TestClass
5
+ class TestEC2Class
6
6
  include PoolParty::Remote::RemoterBase
7
7
  include Ec2
8
8
  include CloudResourcer
@@ -14,6 +14,9 @@ class TestClass
14
14
 
15
15
  def ami;"ami-abc123";end
16
16
  def size; "small";end
17
+ def security_group; "default";end
18
+ def ebs_volume_id; "ebs_volume_id";end
19
+ def availabilty_zone; "us-east-1a";end
17
20
  def verbose
18
21
  false
19
22
  end
@@ -24,7 +27,7 @@ end
24
27
  describe "ec2 remote base" do
25
28
  before(:each) do
26
29
  setup
27
- @tr = TestClass.new
30
+ @tr = TestEC2Class.new
28
31
  stub_remoter_for(@tr)
29
32
  @tr.stub!(:get_instances_description).and_return response_list_of_instances
30
33
  end
@@ -1,6 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  include Remote
4
+ include Aska
4
5
 
5
6
  describe "Remote Instance" do
6
7
  before(:each) do
@@ -58,6 +59,10 @@ describe "Remote Instance" do
58
59
  before(:each) do
59
60
  @ri = RemoteInstance.new(@valid_hash, nil)
60
61
  end
62
+ it "should give the elapsed time" do
63
+ @ri.stub!(:launching_time).and_return(30.minutes.ago)
64
+ @ri.elapsed_runtime.should be >= 1800
65
+ end
61
66
  it "should be say that it is the master if the name is master" do
62
67
  @ri.name.should == "master"
63
68
  @ri.master?.should == true
@@ -10,20 +10,11 @@ module Hype
10
10
  end
11
11
  register_remote_base :Hype
12
12
  end
13
- class TestClass
14
- include Remote
15
- include RemoterBase
16
-
17
- def keypair
18
- "fake_keypair"
19
- end
20
- def verbose
21
- false
22
- end
23
- end
24
13
 
25
14
  describe "Remote" do
26
15
  before(:each) do
16
+ @cloud = cloud :test_cloud do;end
17
+
27
18
  @tc = TestClass.new
28
19
  @tc.stub!(:verbose).and_return false
29
20
  setup
@@ -32,6 +23,9 @@ describe "Remote" do
32
23
  @tc.respond_to?(:using).should == true
33
24
  end
34
25
  it "should include the module with using" do
26
+ @tc.instance_eval do
27
+ @remote_base = nil
28
+ end
35
29
  @tc.should_receive(:extend).with("Hype".preserved_module_constant).once
36
30
  @tc.using :hype
37
31
  end
@@ -59,6 +53,9 @@ describe "Remote" do
59
53
  @tc.using :hype
60
54
  end
61
55
  it "should only include the remote class once" do
56
+ @tc.instance_eval do
57
+ @remote_base = nil
58
+ end
62
59
  @tc.should_receive(:extend).with(Hype).once
63
60
  @tc.using :hype
64
61
  @tc.using :hype
@@ -106,6 +103,8 @@ describe "Remote" do
106
103
  end
107
104
  it "should be true if there are" do
108
105
  add_stub_instance_to(@tc, 8)
106
+ add_stub_instance_to(@tc, 9)
107
+ add_stub_instance_to(@tc, 10)
109
108
  @tc.minimum_number_of_instances_are_running?.should == true
110
109
  end
111
110
  end
@@ -191,10 +190,6 @@ describe "Remote" do
191
190
  @tc.request_termination_of_non_master_instance
192
191
  end
193
192
  end
194
- describe "should_expand_cloud?" do
195
- end
196
- describe "should_contract_cloud?" do
197
- end
198
193
  describe "expansions" do
199
194
  before(:each) do
200
195
  setup
@@ -214,13 +209,21 @@ describe "Remote" do
214
209
  before(:each) do
215
210
  setup
216
211
  stub_list_from_remote_for(@tc)
217
- @tc.stub!(:request_launch_new_instances).and_return PoolParty::Remote::RemoteInstance.new(:ip => "127.0.0.1", :num => 1)
212
+ @ri = PoolParty::Remote::RemoteInstance.new(:ip => "127.0.0.1", :num => 1, :name => "master")
213
+ @tc.stub!(:request_launch_new_instances).and_return @ri
218
214
  @tc.stub!(:can_start_a_new_instance).and_return true
219
215
  @tc.stub!(:list_of_pending_instances).and_return []
220
216
  @tc.stub!(:prepare_for_configuration).and_return true
221
217
  @tc.stub!(:build_and_store_new_config_file).and_return true
222
218
  PoolParty::Provisioner.stub!(:provision_slaves).and_return true
223
- Kernel.stub!(:system).and_return true
219
+ @cloud.stub!(:master).and_return @ri
220
+ @cloud.stub!(:list_of_nonterminated_instances).and_return [@ri]
221
+ @cloud.stub!(:full_keypair_path).and_return "keyairs"
222
+
223
+ @provisioner = PoolParty::Provisioner::Capistrano.new(@ri, @cloud, :ubuntu)
224
+ PoolParty::Provisioner::Capistrano.stub!(:new).and_return @provisioner
225
+ @provisioner.stub!(:install).and_return true
226
+ @provisioner.stub!(:configure).and_return true
224
227
  end
225
228
  it "should receive can_start_a_new_instance?" do
226
229
  @tc.should_receive(:can_start_a_new_instance?).once
@@ -234,12 +237,7 @@ describe "Remote" do
234
237
  end
235
238
  it "should call a new slave provisioner" do
236
239
  @tc.stub!(:should_expand_cloud?).once.and_return true
237
- PoolParty::Provisioner.should_receive(:provision_slave).at_least(1)
238
- # Kernel.should_receive(:system).with(". /etc/profile && cloud-provision -i 5 2>&1 > /dev/null &").and_return true
239
- end
240
- it "should call reconfigure on the master to pick up the new slave" do
241
- @tc.stub!(:should_expand_cloud?).once.and_return true
242
- PoolParty::Provisioner.should_receive(:reconfigure_master).once
240
+ @provisioner.should_receive(:install).at_least(1)
243
241
  end
244
242
  after(:each) do
245
243
  @tc.expand_cloud_if_necessary
@@ -248,9 +246,10 @@ describe "Remote" do
248
246
  describe "contract_cloud_if_necessary" do
249
247
  before(:each) do
250
248
  @tc.stub!(:request_termination_of_non_master_instance).and_return true
251
- @tc.stub!(:can_shutdown_an_instance?).and_return true
249
+ @tc.stub!(:are_any_nodes_exceeding_minimum_runtime?).and_return true
252
250
  @tc.stub!(:wait).and_return true
253
251
  @tc.stub!(:valid_rules?).and_return false
252
+ @tc.stub!(:can_shutdown_an_instance?).and_return true
254
253
  end
255
254
  it "should receive can_shutdown_an_instance?" do
256
255
  @tc.should_receive(:can_shutdown_an_instance?).once
@@ -259,7 +258,7 @@ describe "Remote" do
259
258
  @tc.should_receive(:should_contract_cloud?).once.and_return false
260
259
  end
261
260
  it "should call request_termination_of_non_master_instance if we should_contract_cloud?" do
262
- @tc.should_receive(:should_contract_cloud?).once.and_return true
261
+ @tc.stub!(:should_contract_cloud?).and_return true
263
262
  @tc.should_receive(:request_termination_of_non_master_instance).once.and_return true
264
263
  end
265
264
  after(:each) do
@@ -275,12 +274,6 @@ describe "Remote" do
275
274
  @obj = Object.new
276
275
  @obj.stub!(:ip).and_return "192.168.0.1"
277
276
  end
278
- it "should raise an exception if it cannot find the keypair" do
279
- @tc.stub!(:keypair_path).and_return nil
280
- lambda {
281
- @tc.rsync_storage_files_to(@tc.master)
282
- }.should raise_error
283
- end
284
277
  it "should call exec on the kernel" do
285
278
  @tc.stub!(:keypair).and_return "funky"
286
279
  ::File.stub!(:exists?).with("#{File.expand_path(Base.base_keypair_path)}/id_rsa-funky").and_return true
@@ -1,9 +1,12 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
- include Remote
3
+ class TestRemoteClass
4
+ include CloudResourcer
5
+ include PoolParty::Remote
4
6
 
5
- class TestRemoter
6
- include RemoterBase
7
+ def keypair
8
+ "fake_keypair"
9
+ end
7
10
  end
8
11
 
9
12
  describe "RemoterBase" do
@@ -12,7 +15,7 @@ describe "RemoterBase" do
12
15
  end
13
16
  describe "methods" do
14
17
  before(:each) do
15
- @tr = TestRemoter.new
18
+ @tr = TestRemoteClass.new
16
19
  end
17
20
  %w(launch_new_instance! terminate_instance describe_instance instances_list).each do |method|
18
21
  eval <<-EOE
@@ -22,7 +25,7 @@ describe "RemoterBase" do
22
25
  it "should not raise an exception if #{method} is defined as a method" do
23
26
  lambda {
24
27
  @tr.instance_eval do
25
- def #{method}
28
+ def #{method}
26
29
  end
27
30
  end
28
31
  @tr.#{method}
@@ -32,6 +35,7 @@ describe "RemoterBase" do
32
35
  end
33
36
  describe "lists" do
34
37
  before(:each) do
38
+ @tr = TestClass.new
35
39
  stub_list_of_instances_for(@tr)
36
40
  end
37
41
  it "should gather a list of the running instances" do
@@ -47,7 +51,7 @@ describe "RemoterBase" do
47
51
  @tr.list_of_nonterminated_instances.map {|a| a.name }.should == ["master", "node1", "node3"]
48
52
  end
49
53
  it "should return a list of remote instances" do
50
- @tr.remote_instances_list.first.class.should == RemoteInstance
54
+ @tr.remote_instances_list.first.class.should == PoolParty::Remote::RemoteInstance
51
55
  end
52
56
  describe "by keypairs" do
53
57
  it "should be able to grab all the alist keypairs" do
@@ -74,6 +78,7 @@ describe "RemoterBase" do
74
78
  before(:each) do
75
79
  @master = Object.new
76
80
  @master.stub!(:ip).and_return "192.68.0.1"
81
+ @tr = TestClass.new
77
82
  @tr.stub!(:master).and_return @master
78
83
  end
79
84
  it "should have the method custom_install_tasks" do;@tr.respond_to?(:custom_install_tasks_for).should == true;end
@@ -1,21 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
- include PoolParty::Remote
4
-
5
- def valid_rules?(*args)
6
- false
7
- end
8
-
9
- class TestClass
10
- include CloudResourcer
11
- include Remote
12
- using :ec2
13
- attr_accessor :parent
14
-
15
- def keypair
16
- "fake_keypair"
17
- end
18
- end
19
3
  describe "Remoter" do
20
4
  before(:each) do
21
5
  setup
@@ -27,7 +11,7 @@ describe "Remoter" do
27
11
  end
28
12
  describe "ssh_string" do
29
13
  it "should have the ssh command" do
30
- @tc.ssh_string.should =~ /ssh -o StrictHostKeyChecking=no -l '#{Base.user}' -i/
14
+ @tc.ssh_string.should =~ /ssh -o StrictHostKeyChecking=no -l/
31
15
  end
32
16
  it "should have the keypair in the ssh_string" do
33
17
  @tc.ssh_string.should =~ /#{@tc.keypair}/
@@ -37,9 +21,6 @@ describe "Remoter" do
37
21
  it "should have StrictHostKeyChecking set to no" do
38
22
  @tc.ssh_array.include?("-o StrictHostKeyChecking=no").should == true
39
23
  end
40
- it "should have the user set to the base user class" do
41
- @tc.ssh_array.include?("-l '#{Base.user}'").should == true
42
- end
43
24
  it "should have the keypair path in the ssh_array" do
44
25
  @tc.ssh_array.include?('-i "'+@tc.full_keypair_path+'"').should == true
45
26
  end
@@ -50,7 +31,7 @@ describe "Remoter" do
50
31
  @ri.stub!(:ip).and_return "192.168.0.22"
51
32
  end
52
33
  it "should have rsync in the rsync_command" do
53
- @tc.rsync_command.should == "rsync -azP --exclude cache -e '#{@tc.ssh_string}'"
34
+ @tc.rsync_command.should == "rsync -azP --exclude cache -e '#{@tc.ssh_string} -l #{Base.user}'"
54
35
  end
55
36
  it "should be able to rsync storage commands" do
56
37
  @tc.rsync_storage_files_to_command(@ri).should == "#{@tc.rsync_command} #{Base.storage_directory}/ 192.168.0.22:/var/poolparty"
@@ -60,15 +41,22 @@ describe "Remoter" do
60
41
  before(:each) do
61
42
  @tc.stub!(:wait).and_return true
62
43
  stub_list_from_remote_for(@tc)
44
+ stub_remoting_methods_for(@tc)
63
45
  @tc.stub!(:maximum_instances).and_return 5
64
46
  @tc.stub!(:list_of_pending_instances).and_return []
47
+ @tc.stub!(:list_of_nonterminated_instances).and_return []
65
48
  @tc.stub!(:list_of_running_instances).and_return []
66
49
  @tc.stub!(:master).and_return ris.first
67
50
  @tc.stub!(:after_launched).and_return true
68
51
  @tc.stub!(:verbose).and_return false
69
- Provisioner.stub!(:provision_master).and_return true
70
- Provisioner.stub!(:reconfigure_master).and_return true
71
- Provisioner.stub!(:clear_master_ssl_certs).and_return true
52
+ ::File.stub!(:exists?).and_return true
53
+
54
+ @pb = PoolParty::Provisioner::Capistrano.new(nil, @tc)
55
+ PoolParty::Provisioner::Capistrano.stub!(:new).and_return @pb
56
+ @pb.stub!(:setup_runner)
57
+ @pb.stub!(:install).and_return true
58
+ @pb.stub!(:configure).and_return true
59
+ @pb.stub!(:create_roles).and_return true
72
60
  end
73
61
  it "should have the method launch_master!" do
74
62
  @tc.respond_to?(:launch_and_configure_master!).should == true
@@ -84,12 +72,52 @@ describe "Remoter" do
84
72
  @tc.stub!(:can_start_a_new_instance?).and_return true
85
73
  @tc.stub!(:is_master_running?).and_return false
86
74
  end
87
- it "should tell the provisioner to provision_master" do
88
- Provisioner.should_receive(:provision_master).once.and_return true
89
- end
90
75
  after(:each) do
91
76
  @tc.launch_and_configure_master!
92
77
  end
93
78
  end
79
+ describe "expansions and contractions" do
80
+ before(:each) do
81
+ @tc = TestClass.new
82
+ stub_list_from_remote_for @tc # sets the list of instances to 2
83
+ end
84
+ describe "list_of_nodes_exceeding_minimum_runtime" do
85
+ before(:each) do
86
+ @tc.stub!(:minimum_runtime).and_return 3000
87
+ end
88
+ it "should not be empty" do
89
+ @tc.list_of_running_instances.size.should == 2
90
+ @tc.list_of_running_instances.first.elapsed_runtime.should be > 3000
91
+ @tc.list_of_nodes_exceeding_minimum_runtime.size.should be > 0
92
+ end
93
+ it "should return a RemoteInstance" do
94
+ @tc.list_of_nodes_exceeding_minimum_runtime.first.should be_instance_of(PoolParty::Remote::RemoteInstance)
95
+ end
96
+ it "are_any_nodes_exceeding_minimum_runtime? should be true" do
97
+ @tc.are_any_nodes_exceeding_minimum_runtime?.should == true
98
+ end
99
+ end
100
+
101
+ describe "are_too_few_instances_running?" do
102
+ it "should be false if the number of running instances is larger than the minimum instances" do
103
+ @tc.stub!(:minimum_instances).and_return 1
104
+ @tc.are_too_few_instances_running?.should == false
105
+ end
106
+ it "should be true if the number of running instances is smaller than the minimum instances" do
107
+ @tc.stub!(:minimum_instances).and_return 5
108
+ @tc.are_too_few_instances_running?.should == true
109
+ end
110
+ end
111
+ describe "are_too_many_instances_running?" do
112
+ it "should be true if the number of running instances is larger than the maximum instances" do
113
+ @tc.stub!(:maximum_instances).and_return 1
114
+ @tc.are_too_many_instances_running?.should == true
115
+ end
116
+ it "should be false if the number of running instances is smaller than the maximum instances" do
117
+ @tc.stub!(:maximum_instances).and_return 5
118
+ @tc.are_too_many_instances_running?.should == false
119
+ end
120
+ end
121
+ end
94
122
 
95
123
  end
@@ -8,6 +8,7 @@ end
8
8
  describe "Remote Instance" do
9
9
  before(:each) do
10
10
  reset_resources!
11
+ Kernel.stub!(:system).and_return true
11
12
  end
12
13
  describe "wrapped" do
13
14
  before(:each) do
@@ -0,0 +1,45 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ include PoolParty::Resources
4
+
5
+ class TestGitClass
6
+ include PoolParty::Resources
7
+
8
+ def options(h={})
9
+ {}
10
+ end
11
+ end
12
+ describe "Remote Instance" do
13
+ before(:each) do
14
+ reset_resources!
15
+ end
16
+ describe "wrapped" do
17
+ before(:each) do
18
+ @tc = TestGitClass.new
19
+ end
20
+ it "should be a string" do
21
+ @tc.has_git(:at => "/var/www/", :name => "gitrepos.git", :source => "git://source.git").to_string.should =~ /exec/
22
+ end
23
+ it "should included the flushed out options" do
24
+ @tc.has_git({:name => "git.git", :source => "git://source.git", :requires_user => "finger", :at => "/var/www/"}).to_string.should =~ /finger@git:/
25
+ end
26
+ it "should not include the user if none is given" do
27
+ @tc.has_git({:name => "git.git", :source => "git://source.git",:at => "/var/www/"}).to_string.should =~ /git clone git:/
28
+ end
29
+ describe "in resource" do
30
+ before(:each) do
31
+ @tc.instance_eval do
32
+ has_git(:name => "gittr") do
33
+ source "git://source.git"
34
+ path "/var/www/xnot.org"
35
+ symlink "/var/www/xnot.org/public"
36
+ at "/var/www"
37
+ end
38
+ end
39
+ end
40
+ it "should have the path set within the resource" do
41
+ @tc.resource(:git).first.to_string.should =~ /exec \{ \"git-gittr/
42
+ end
43
+ end
44
+ end
45
+ end
@@ -302,6 +302,7 @@ describe "Cloud" do
302
302
  describe "prepare_for_configuration" do
303
303
  before(:each) do
304
304
  @cloud.stub!(:copy_ssh_key).and_return true
305
+ @cloud.stub!(:before_configuration_tasks).and_return []
305
306
  end
306
307
  it "should make_base_directory" do
307
308
  @cloud.should_receive(:make_base_directory).at_least(1)
@@ -312,6 +313,12 @@ describe "Cloud" do
312
313
  it "should copy_custom_monitors" do
313
314
  @cloud.should_receive(:copy_custom_monitors).once
314
315
  end
316
+ it "should call before_configuration_tasks callback" do
317
+ @cloud.should_receive(:before_configuration_tasks).once
318
+ end
319
+ it "should call call write_unique_cookie" do
320
+ @cloud.should_receive(:write_unique_cookie).once
321
+ end
315
322
  describe "copy_custom_monitors" do
316
323
  before(:each) do
317
324
  Base.stub!(:custom_monitor_directories).and_return ["/tmp/monitors/custom_monitor.rb"]
@@ -360,6 +367,40 @@ describe "Cloud" do
360
367
  end
361
368
  end
362
369
  end
370
+ describe "minimum_runnable_options" do
371
+ it "should be an array on the cloud" do
372
+ @cloud.minimum_runnable_options.class.should == Array
373
+ end
374
+ ["keypair","minimum_instances","maximum_instances",
375
+ "expand_when","contract_when","set_master_ip_to"].each do |k|
376
+ eval <<-EOE
377
+ it "should have #{k} in the minimum_runnable_options" do
378
+ @cloud.minimum_runnable_options.include?(:#{k}).should == true
379
+ end
380
+ EOE
381
+ end
382
+ it "should include the custom_minimum_runnable_options" do
383
+ @cloud.stub!(:custom_minimum_runnable_options).and_return [:blank]
384
+ @cloud.minimum_runnable_options.include?(:blank).should == true
385
+ end
386
+ end
387
+ describe "unique_cookie" do
388
+ it "should have the method generate generate_unique_cookie_string" do
389
+ @cloud.respond_to?(:generate_unique_cookie_string).should == true
390
+ end
391
+ it "should call hexdigest to digest/sha" do
392
+ Digest::SHA256.should_receive(:hexdigest).with("#{@cloud.full_keypair_name}#{@cloud.name}")
393
+ @cloud.generate_unique_cookie_string
394
+ end
395
+ it "should generate the same cookie string every time" do
396
+ older = @cloud.generate_unique_cookie_string
397
+ old = @cloud.generate_unique_cookie_string
398
+ new_one = @cloud.generate_unique_cookie_string
399
+ older.should == old
400
+ old.should == new_one
401
+ new_one.should == older
402
+ end
403
+ end
363
404
  end
364
405
 
365
406
  describe "instances" do
@@ -100,7 +100,7 @@ describe "Plugin" do
100
100
  Kernel::PoolPartyApacheClass.stub!(:new).and_return @plugin
101
101
  end
102
102
  it "should call enable on calling realize! when there is no block included" do
103
- @plugin.should_receive(:enable).and_return true
103
+ @plugin.should_receive(:enable).at_least(1).and_return true
104
104
  @cloud = cloud :app do
105
105
  apache
106
106
  end
@@ -25,7 +25,7 @@ describe "Pool" do
25
25
  @pool.respond_to?(:cloud).should == true
26
26
  end
27
27
  it "should evaluate the block when creating a new pool" do
28
- Proc.should_receive(:new).once
28
+ Proc.should_receive(:new).at_least(1)
29
29
  Pool.new(:test) do
30
30
  Proc.new {puts "hi"}
31
31
  end
@@ -240,6 +240,11 @@ describe "Resource" do
240
240
  it "should say there is 1 resource because the lower-level resources should be contained on the parenting resource" do
241
241
  @cloud1.resources.size.should == 1
242
242
  end
243
+ it "should set the exec to notify apache2" do
244
+ has_service("apache2")
245
+ has_exec(:name => "reload-page", :notify => get_service("apache2"))
246
+ resource(:exec).get_named("reload-page").first.options[:notify].to_s.should == "Service['apache2']"
247
+ end
243
248
  it "should say there is one resource on the outer resource" do
244
249
  @dir.resources.size.should == 1
245
250
  end
@@ -250,6 +255,14 @@ describe "Resource" do
250
255
  @file.parent.to_s.should == @dir.to_s
251
256
  end
252
257
  end
258
+ describe "handle_option_value" do
259
+ it "should turn a string into a hash with the string as the key name" do
260
+ handle_option_values("vat of cats").should == {:name => "vat of cats"}
261
+ end
262
+ it "should not change a hash into anything" do
263
+ handle_option_values({:name => "poe"}).should == {:name => "poe"}
264
+ end
265
+ end
253
266
  describe "fetching" do
254
267
  before(:each) do
255
268
  @file = file(:name => "pancakes")
@@ -283,10 +296,10 @@ describe "Resource" do
283
296
  end
284
297
  describe "virtual_resources" do
285
298
  before(:each) do
286
- @virtual_resource = git(:name => "tank", :source => "git://github.com/auser/testgit.git")
299
+ @virtual_resource = git(:at => "/var/paint/cans", :name => "tank", :source => "git://github.com/auser/testgit.git")
287
300
  end
288
301
  it "should fetch a virtual resource the same" do
289
- git(:name => "tank", :source => "git://github.com/auser/testgit.git").to_s.should == @virtual_resource.to_s
302
+ git(:at => "/var/paint/cans", :name => "tank", :source => "git://github.com/auser/testgit.git").to_s.should == @virtual_resource.to_s
290
303
  end
291
304
  end
292
305
  end
@@ -0,0 +1,38 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ include PoolParty::Resources
4
+
5
+ describe "User" do
6
+ describe "instances" do
7
+ before(:each) do
8
+ @user = remote_user({:name => "fred"})
9
+ end
10
+ it "should turn the one hash instance into a string" do
11
+ @user.to_string.should =~ /"fred":/
12
+ end
13
+ it "should turn the two hash instance into a string" do
14
+ @user = remote_user do
15
+ name "bob"
16
+ home "/home/bob"
17
+ end
18
+ @user.to_string.should =~ /"bob":/
19
+ @user.to_string.should =~ /home => '\/home\/bob'/
20
+ end
21
+ describe "as included" do
22
+ before(:each) do
23
+ @user = remote_user({:rent => "low"}) do
24
+ name "/www/conf/httpd.conf"
25
+ end
26
+ end
27
+ it "should use default values" do
28
+ @user.name.should == "/www/conf/httpd.conf"
29
+ end
30
+ it "should keep the default values for the user" do
31
+ @user.shell.should == "/bin/sh"
32
+ end
33
+ it "should also set options through a hash" do
34
+ @user.rent.should == "low"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -28,6 +28,6 @@ describe "PoolParty" do
28
28
  end
29
29
  end
30
30
  it "should have a logger" do
31
- PoolParty.logger.should_not be_nil
31
+ PoolParty.log.should_not be_nil
32
32
  end
33
33
  end
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe "Capistrano provisioner" do
4
+ before(:each) do
5
+ @cloud = cloud :app do;end
6
+ @remote_instance = PoolParty::Remote::RemoteInstance.new({:ip => "192.168.0.1", :status => "running", :name => "master"}, @cloud)
7
+ stub_list_from_remote_for(@cloud)
8
+ end
9
+ describe "instance" do
10
+ before(:each) do
11
+ @pb = PoolParty::Provisioner::Capistrano.new(@remote_instance, @cloud)
12
+ end
13
+ it "should create the config on the initialize" do
14
+ @pb.config.class.should == ::Capistrano::Configuration
15
+ end
16
+ describe "config" do
17
+ it "should create the config at ::Capistrano::Logger::INFO if the cloud is verbose" do
18
+ @cloud.stub!(:verbose).and_return true
19
+ PoolParty::Provisioner::Capistrano.new(nil, @cloud).config.logger.level.should == ::Capistrano::Logger::INFO
20
+ end
21
+ it "should create the config at ::Capistrano::Logger::IMPORTANT if the cloud is not verbose" do
22
+ @cloud.stub!(:verbose).and_return false
23
+ PoolParty::Provisioner::Capistrano.new(nil, @cloud).config.logger.level.should == ::Capistrano::Logger::IMPORTANT
24
+ end
25
+ end
26
+ end
27
+ end