poolparty 0.2.18 → 0.2.69
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.
- data/Manifest.txt +142 -47
- data/PostInstall.txt +5 -5
- data/README.txt +25 -4
- data/Rakefile +46 -2
- data/bin/cloud +12 -21
- data/bin/cloud-add-keypair +18 -13
- data/bin/cloud-configure +11 -18
- data/bin/cloud-contract +7 -17
- data/bin/cloud-ensure-provisioning +39 -0
- data/bin/cloud-expand +9 -17
- data/bin/cloud-handle-load +27 -0
- data/bin/cloud-list +3 -9
- data/bin/cloud-maintain +12 -18
- data/bin/cloud-osxcopy +3 -9
- data/bin/cloud-provision +20 -21
- data/bin/cloud-refresh +4 -13
- data/bin/cloud-run +3 -4
- data/bin/cloud-ssh +3 -2
- data/bin/cloud-start +18 -21
- data/bin/cloud-stats +17 -0
- data/bin/cloud-terminate +4 -7
- data/bin/messenger-get-current-nodes +14 -0
- data/bin/pool +12 -12
- data/bin/pool-describe +0 -1
- data/bin/{pool-spec → pool-generate} +1 -0
- data/bin/pool-init +28 -0
- data/bin/pool-list +14 -12
- data/bin/pool-start +11 -17
- data/bin/server-build-messenger +13 -6
- data/bin/server-fire-cmd +1 -1
- data/bin/server-get-load +5 -16
- data/bin/server-list-active +3 -10
- data/bin/server-rerun +4 -4
- data/bin/server-send-command +18 -0
- data/bin/server-show-stats +17 -0
- data/bin/server-start-client +29 -0
- data/bin/server-start-master +13 -14
- data/bin/server-start-node +14 -15
- data/bin/server-stop-client +3 -0
- data/bin/server-stop-master +3 -0
- data/bin/server-stop-node +3 -0
- data/bin/server-update-hosts +48 -0
- data/config/hoe.rb +4 -3
- data/examples/plugin_without_plugin_directory.rb +1 -2
- data/generators/poolspec/USAGE +2 -2
- data/generators/poolspec/poolspec_generator.rb +2 -1
- data/generators/poolspec/templates/pool_spec_template.erb +3 -2
- data/lib/erlang/messenger/Rakefile +12 -0
- data/lib/erlang/messenger/ebin/client.app +19 -0
- data/lib/erlang/messenger/ebin/master.app +1 -1
- data/lib/erlang/messenger/ebin/node.app +1 -1
- data/lib/erlang/messenger/ebin/pm_client_rel-0.1.rel +1 -0
- data/lib/erlang/messenger/ebin/pm_master_rel-0.1.rel +1 -1
- data/lib/erlang/messenger/ebin/pm_node_rel-0.1.rel +1 -1
- data/lib/erlang/messenger/include/defines.hrl +27 -0
- data/lib/erlang/messenger/lib/eunit/.svn/all-wcprops +53 -0
- data/lib/erlang/messenger/lib/eunit/.svn/entries +140 -0
- data/lib/erlang/messenger/lib/eunit/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/.svn/prop-base/NOTES.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/AUTHORS.svn-base +2 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/CHANGELOG.svn-base +14 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/COPYING.svn-base +504 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/NOTES.svn-base +276 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/README.svn-base +3 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/sys.config.svn-base +9 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/vsn.mk.svn-base +1 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/all-wcprops +59 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/entries +142 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/erlang.png.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/eunit.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/index.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/modules-frame.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/overview-summary.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/packages-frame.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/edoc-info.svn-base +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/erlang.png.svn-base +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/eunit.html.svn-base +172 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/index.html.svn-base +17 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/modules-frame.html.svn-base +12 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview-summary.html.svn-base +984 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview.edoc.svn-base +980 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/packages-frame.html.svn-base +11 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/stylesheet.css.svn-base +55 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/all-wcprops +5 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/dir-prop-base +8 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/entries +28 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/all-wcprops +23 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/entries +66 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/eunit_examples.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/fib.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/eunit_examples.erl.svn-base +339 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/fib.erl.svn-base +19 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/tests.txt.svn-base +1 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/all-wcprops +11 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/entries +41 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/prop-base/eunit.hrl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/text-base/eunit.hrl.svn-base +313 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/all-wcprops +113 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/entries +259 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/autoload.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/code_monitor.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_autoexport.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_data.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_internal.hrl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_lib.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_proc.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_serial.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_server.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_striptests.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_test.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tests.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tty.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/file_monitor.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/autoload.erl.svn-base +388 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/code_monitor.erl.svn-base +243 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.app.src.svn-base +21 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.appup.src.svn-base +1 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.erl.svn-base +196 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_autoexport.erl.svn-base +102 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_data.erl.svn-base +798 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_internal.hrl.svn-base +48 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_lib.erl.svn-base +682 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_proc.erl.svn-base +552 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_serial.erl.svn-base +157 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_server.erl.svn-base +340 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_striptests.erl.svn-base +64 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_test.erl.svn-base +334 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tests.erl.svn-base +45 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tty.erl.svn-base +272 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/file_monitor.erl.svn-base +409 -0
- data/lib/erlang/messenger/pm_client_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_client_rel-0.1.script +238 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +82 -85
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +80 -85
- data/lib/erlang/messenger/src/client_app.erl +39 -0
- data/lib/erlang/messenger/src/client_server.erl +60 -0
- data/lib/erlang/messenger/src/pm_client.erl +48 -18
- data/lib/erlang/messenger/src/pm_client_old.erl +52 -0
- data/lib/erlang/messenger/src/pm_client_supervisor.erl +38 -0
- data/lib/erlang/messenger/src/pm_cluster.erl +20 -16
- data/lib/erlang/messenger/src/pm_event_manager.erl +27 -0
- data/lib/erlang/messenger/src/pm_master.erl +126 -34
- data/lib/erlang/messenger/src/pm_master_event_handler.erl +72 -0
- data/lib/erlang/messenger/src/pm_master_supervisor.erl +9 -10
- data/lib/erlang/messenger/src/pm_node.erl +107 -30
- data/lib/erlang/messenger/src/pm_node_supervisor.erl +13 -15
- data/lib/erlang/messenger/src/pm_packager.erl +5 -2
- data/lib/erlang/messenger/src/pm_strings.erl +11 -0
- data/lib/erlang/messenger/src/utils.erl +43 -8
- data/lib/erlang/messenger/useful_snippets +17 -0
- data/lib/poolparty/aska/aska.rb +150 -0
- data/lib/poolparty/base_packages/haproxy.rb +19 -26
- data/lib/poolparty/base_packages/heartbeat.rb +48 -47
- data/lib/poolparty/base_packages/poolparty.rb +88 -36
- data/lib/poolparty/base_packages/runit.rb +21 -0
- data/lib/poolparty/config/postlaunchmessage.txt +5 -0
- data/lib/poolparty/core/array.rb +4 -1
- data/lib/poolparty/core/class.rb +2 -0
- data/lib/poolparty/core/exception.rb +2 -1
- data/lib/poolparty/core/hash.rb +2 -2
- data/lib/poolparty/core/kernel.rb +3 -3
- data/lib/poolparty/core/metaid.rb +15 -0
- data/lib/poolparty/core/object.rb +42 -2
- data/lib/poolparty/core/string.rb +21 -6
- data/lib/poolparty/core/symbol.rb +9 -0
- data/lib/poolparty/dependency_resolutions/puppet.rb +20 -7
- data/lib/poolparty/exceptions/CloudNotFoundException.rb +7 -0
- data/lib/poolparty/exceptions/LoadRulesException.rb +7 -0
- data/lib/poolparty/exceptions/MasterException.rb +10 -0
- data/lib/poolparty/helpers/binary.rb +37 -4
- data/lib/poolparty/helpers/console.rb +25 -8
- data/lib/poolparty/helpers/nice_printer.rb +36 -0
- data/lib/poolparty/helpers/optioner.rb +51 -16
- data/lib/poolparty/helpers/provisioner_base.rb +117 -28
- data/lib/poolparty/helpers/provisioners/master.rb +102 -35
- data/lib/poolparty/helpers/provisioners/slave.rb +25 -9
- data/lib/poolparty/modules/cloud_dsl.rb +13 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +51 -8
- data/lib/poolparty/modules/configurable.rb +1 -1
- data/lib/poolparty/modules/definable_resource.rb +2 -2
- data/lib/poolparty/modules/file_writer.rb +37 -6
- data/lib/poolparty/modules/method_missing_sugar.rb +8 -3
- data/lib/poolparty/modules/pretty_printer.rb +1 -0
- data/lib/poolparty/modules/resourcing_dsl.rb +4 -2
- data/lib/poolparty/modules/thread_pool.rb +106 -0
- data/lib/poolparty/monitors/base_monitor.rb +65 -6
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +1 -1
- data/lib/poolparty/monitors/monitors/memory_monitor.rb +28 -1
- data/lib/poolparty/monitors/monitors/web_monitor.rb +18 -0
- data/lib/poolparty/net/messenger.rb +72 -0
- data/lib/poolparty/net/remote.rb +5 -2
- data/lib/poolparty/net/remote_bases/ec2/ec2_response_object.rb +66 -0
- data/lib/poolparty/net/remote_bases/ec2.rb +133 -131
- data/lib/poolparty/net/remote_instance.rb +28 -6
- data/lib/poolparty/net/remoter.rb +117 -64
- data/lib/poolparty/net/remoter_base.rb +49 -11
- data/lib/poolparty/plugins/deploydirectory.rb +66 -0
- data/lib/poolparty/plugins/line.rb +5 -4
- data/lib/poolparty/plugins/rsyncmirror.rb +26 -0
- data/lib/poolparty/plugins/runit.rb +96 -0
- data/lib/poolparty/plugins/svn.rb +1 -1
- data/lib/poolparty/pool/base.rb +47 -18
- data/lib/poolparty/pool/cloud.rb +121 -65
- data/lib/poolparty/pool/custom_resource.rb +4 -20
- data/lib/poolparty/pool/loggable.rb +3 -8
- data/lib/poolparty/pool/plugin.rb +14 -19
- data/lib/poolparty/pool/plugin_model.rb +8 -8
- data/lib/poolparty/pool/pool.rb +28 -11
- data/lib/poolparty/pool/resource.rb +109 -40
- data/lib/poolparty/pool/resources/class_package.rb +74 -33
- data/lib/poolparty/pool/resources/conditional.rb +32 -10
- data/lib/poolparty/pool/resources/custom_service.rb +30 -0
- data/lib/poolparty/pool/resources/exec.rb +6 -5
- data/lib/poolparty/pool/resources/gem_package.rb +52 -0
- data/lib/poolparty/pool/resources/mount.rb +22 -0
- data/lib/poolparty/pool/resources/package.rb +13 -3
- data/lib/poolparty/pool/resources/sshkey.rb +1 -1
- data/lib/poolparty/pool/resources/variable.rb +4 -0
- data/lib/poolparty/pool/script.rb +8 -6
- data/lib/poolparty/templates/haproxy.conf +1 -1
- data/lib/poolparty/templates/messenger/client/log-run.erb +2 -0
- data/lib/poolparty/templates/messenger/client/run.erb +4 -0
- data/lib/poolparty/templates/messenger/master/log-run.erb +2 -0
- data/lib/poolparty/templates/messenger/master/run.erb +4 -0
- data/lib/poolparty/templates/messenger/node/log-run.erb +2 -0
- data/lib/poolparty/templates/messenger/node/run.erb +4 -0
- data/lib/poolparty/templates/poolparty.monitor +1 -1
- data/lib/poolparty/templates/puppet.conf +0 -0
- data/lib/poolparty/templates/puppetcleaner +6 -0
- data/lib/poolparty/templates/puppetrerun +9 -0
- data/lib/poolparty/templates/puppetrunner +8 -0
- data/lib/poolparty/templates/yaws.conf +19 -0
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +35 -6
- data/lib/poolpartycl.rb +4 -0
- data/log/pool.logs +0 -0
- data/poolparty.gemspec +574 -61
- data/spec/poolparty/aska/aska_spec.rb +122 -0
- data/spec/poolparty/bin/console_spec.rb +18 -0
- data/spec/poolparty/core/hash_spec.rb +4 -4
- data/spec/poolparty/core/object_spec.rb +29 -0
- data/spec/poolparty/core/string_spec.rb +6 -0
- data/spec/poolparty/core/time_spec.rb +0 -3
- data/spec/poolparty/helpers/binary_spec.rb +2 -2
- data/spec/poolparty/helpers/optioner_spec.rb +1 -4
- data/spec/poolparty/helpers/provisioner_base_spec.rb +14 -1
- data/spec/poolparty/helpers/provisioners/master_spec.rb +3 -3
- data/spec/poolparty/modules/cloud_resourcer_spec.rb +3 -3
- data/spec/poolparty/modules/configurable_spec.rb +4 -1
- data/spec/poolparty/monitors/base_monitor_spec.rb +94 -2
- data/spec/poolparty/monitors/monitors/cpu_monitor_spec.rb +0 -1
- data/spec/poolparty/monitors/monitors/memory_monitor_spec.rb +47 -0
- data/spec/poolparty/{helpers → net}/messenger_spec.rb +3 -1
- data/spec/poolparty/net/remote_bases/ec2_spec.rb +46 -5
- data/spec/poolparty/net/remote_instance_spec.rb +2 -1
- data/spec/poolparty/net/remote_spec.rb +30 -8
- data/spec/poolparty/net/remoter_base_spec.rb +4 -1
- data/spec/poolparty/net/remoter_spec.rb +11 -108
- data/spec/poolparty/plugins/deploydirectory_spec.rb +51 -0
- data/spec/poolparty/pool/base_spec.rb +43 -33
- data/spec/poolparty/pool/cloud_spec.rb +299 -248
- data/spec/poolparty/pool/custom_resource_spec.rb +10 -5
- data/spec/poolparty/pool/example_spec.rb +0 -84
- data/spec/poolparty/pool/plugin_model_spec.rb +3 -2
- data/spec/poolparty/pool/plugin_spec.rb +89 -62
- data/spec/poolparty/pool/pool_spec.rb +17 -2
- data/spec/poolparty/pool/resource_spec.rb +341 -236
- data/spec/poolparty/pool/resources/class_package_spec.rb +102 -66
- data/spec/poolparty/pool/resources/conditional_spec.rb +65 -26
- data/spec/poolparty/pool/resources/cron_spec.rb +3 -2
- data/spec/poolparty/pool/resources/exec_spec.rb +1 -1
- data/spec/poolparty/pool/resources/gem_spec.rb +18 -14
- data/spec/poolparty/pool/resources/remote_file_spec.rb +1 -1
- data/spec/poolparty/pool/resources/variable_spec.rb +1 -1
- data/spec/poolparty/pool/script_spec.rb +58 -37
- data/spec/poolparty/pool/test_plugins/webserver.rb +1 -0
- data/spec/poolparty/spec_helper.rb +16 -5
- data/tasks/deployment.rake +19 -3
- data/tasks/development.rake +11 -2
- data/tasks/ec2.rake +9 -1
- data/website/index.html +2 -2
- metadata +167 -70
- data/bin/pool-provision +0 -34
- data/erl_crash.dump +0 -8409
- data/examples/with_apache_plugin.rb +0 -22
- data/lib/erlang/messenger/Makefile +0 -15
- data/lib/erlang/messenger/ebin/master_app.beam +0 -0
- data/lib/erlang/messenger/ebin/node_app.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_event_handler.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
- data/lib/erlang/messenger/ebin/utils.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +0 -28
- data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/src/Makefile +0 -46
- data/lib/erlang/messenger/src/pm_event_handler.erl +0 -21
- data/lib/poolparty/config/allowed_commands.yml +0 -1
- data/lib/poolparty/helpers/messenger.rb +0 -29
- data/lib/poolparty/plugins/git.rb +0 -39
- data/lib/poolparty/pool/resources/gem.rb +0 -28
- data/lib/poolparty/pool/tmp/.ppkeys +0 -3
- data/lib/poolparty/pool/tmp/happydayz +0 -1
- data/lib/poolparty/pool/tmp/install_master.sh +0 -33
- data/lib/poolparty/pool/tmp/pool.spec +0 -11
- data/lib/poolparty/pool/tmp/poolparty.pp +0 -600
- data/lib/poolparty/pool/tmp/tc-instances.list +0 -1
- data/lib/poolparty/templates/fileserver.conf +0 -4
- data/spec/poolparty/plugins/git_spec.rb +0 -33
- data/test_manifest.pp +0 -658
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
class Car
|
|
4
|
+
include Aska
|
|
5
|
+
rules :names, [
|
|
6
|
+
"x > 0",
|
|
7
|
+
"y > 0",
|
|
8
|
+
"x > y"
|
|
9
|
+
]
|
|
10
|
+
end
|
|
11
|
+
describe "Rules" do
|
|
12
|
+
before(:each) do
|
|
13
|
+
@car = Car.new
|
|
14
|
+
end
|
|
15
|
+
describe "malformed rules" do
|
|
16
|
+
[
|
|
17
|
+
"k > 10",
|
|
18
|
+
"x == 2",
|
|
19
|
+
"x >= 2",
|
|
20
|
+
"x <= 4",
|
|
21
|
+
"y < 10"
|
|
22
|
+
].each do |str|
|
|
23
|
+
eval <<-EOE
|
|
24
|
+
it "should have the rule #{str} be valid" do
|
|
25
|
+
(str =~ /(.+)[=\\\<\>](.*)/).nil?.should == false
|
|
26
|
+
end
|
|
27
|
+
EOE
|
|
28
|
+
end
|
|
29
|
+
[
|
|
30
|
+
"k running 10",
|
|
31
|
+
"10 is larger than 2"
|
|
32
|
+
].each do |str|
|
|
33
|
+
eval <<-EOE
|
|
34
|
+
it "should have the rule #{str} not be valid" do
|
|
35
|
+
(str =~ /(.+)[=\\\<\>](.*)/).nil?.should == true
|
|
36
|
+
end
|
|
37
|
+
EOE
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
it "should be able to define rules as an array and they should be set as the rules on the class" do
|
|
41
|
+
@car.rules.class.should == Hash
|
|
42
|
+
end
|
|
43
|
+
it "should be able to look up the rules based on the name into an array" do
|
|
44
|
+
@car.names.class.should == Aska::Rules
|
|
45
|
+
end
|
|
46
|
+
it "should be able to turn them into a string" do
|
|
47
|
+
@car.names.to_s.should == "'x > 0', 'y > 0', 'x > y'"
|
|
48
|
+
end
|
|
49
|
+
it "should be able to say that rules are defined when they are defined" do
|
|
50
|
+
@car.names.should_not be_nil
|
|
51
|
+
end
|
|
52
|
+
it "should be able tos ay that rules are not defined when they are not defined" do
|
|
53
|
+
@car.look_up_rules(:cars_and_wheels).should be_empty
|
|
54
|
+
end
|
|
55
|
+
it "should be able to say if the rules are not rules" do
|
|
56
|
+
@car.are_rules?(:cars_and_wheels).should be_false
|
|
57
|
+
end
|
|
58
|
+
it "should be able to say that rules are rules" do
|
|
59
|
+
@car.are_rules?(:names).should be_true
|
|
60
|
+
end
|
|
61
|
+
describe "parsing" do
|
|
62
|
+
it "should be able to parse the x > 0 into an array" do
|
|
63
|
+
@car.names.include?({"x"=>[">","0"]}).should == true
|
|
64
|
+
end
|
|
65
|
+
it "should be able to parse y > 0 into an array" do
|
|
66
|
+
@car.names.include?({"y"=>[">","0"]}).should == true
|
|
67
|
+
end
|
|
68
|
+
it "should be able to parse x > y into the hash" do
|
|
69
|
+
@car.names.include?({"x"=>[">","y"]}).should == true
|
|
70
|
+
end
|
|
71
|
+
it "should have 3 rules" do
|
|
72
|
+
@car.names.size.should == 3
|
|
73
|
+
end
|
|
74
|
+
it "should be able to look up the names as a rule" do
|
|
75
|
+
Car.look_up_rules(:names).should == [{"x"=>[">", "0"]}, {"y"=>[">", "0"]}, {"x"=>[">", "y"]}]
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
# it "should use x if available instead of x_aska" do
|
|
79
|
+
# @car.x = 6
|
|
80
|
+
# @car.get_var(:x).class.should == @car.x_aska.class
|
|
81
|
+
# end
|
|
82
|
+
# it "should be able to get the variable associated with the instance and return it" do
|
|
83
|
+
# @car.x_aska = 4
|
|
84
|
+
# @car.get_var(:x).class.should == @car.x_aska.class
|
|
85
|
+
# end
|
|
86
|
+
it "should be able to get a number with the instance and return it as a float" do
|
|
87
|
+
@car.__aska_get_var(4).class.should == Float
|
|
88
|
+
end
|
|
89
|
+
it "should be able to get the method it's applying as a method symbol" do
|
|
90
|
+
@car.__aska_get_var(:<).class.should == Symbol
|
|
91
|
+
end
|
|
92
|
+
it "should be able to get the method as a symbol" do
|
|
93
|
+
@car.__aska_get_var("<").class.should == Symbol
|
|
94
|
+
end
|
|
95
|
+
it "should be able to retrieve the value of the rule when checking if it's valid" do
|
|
96
|
+
@car.x = 10
|
|
97
|
+
@car.valid_rule?({:x => [:==, 10]}).should == true
|
|
98
|
+
end
|
|
99
|
+
it "should be able to apply the rules and say that they are not met when they aren't" do
|
|
100
|
+
@car.valid_rules?(:names).should == false
|
|
101
|
+
end
|
|
102
|
+
it "should be able to apply the rules and say they aren't valid when they aren't all met" do
|
|
103
|
+
@car.x = 5
|
|
104
|
+
@car.y = 10
|
|
105
|
+
@car.valid_rules?(:names).should == true
|
|
106
|
+
end
|
|
107
|
+
it "should be able to apply the rules and say they aren't valid when they aren't all met" do
|
|
108
|
+
@car.x = 5
|
|
109
|
+
@car.y = 0
|
|
110
|
+
@car.valid_rules?(:names).should == false
|
|
111
|
+
end
|
|
112
|
+
it "should be able to apply the rules and say that they are in fact valid" do
|
|
113
|
+
@car.x = 10
|
|
114
|
+
@car.y = 5
|
|
115
|
+
@car.valid_rules?(:names).should == true
|
|
116
|
+
end
|
|
117
|
+
it "should have the rules in an array of hashes" do
|
|
118
|
+
@car.names.each do |n|
|
|
119
|
+
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -56,6 +56,24 @@ describe "Console" do
|
|
|
56
56
|
reload!
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
|
+
describe "pools" do
|
|
60
|
+
before(:each) do
|
|
61
|
+
@filename = "myspec.spec"
|
|
62
|
+
::File.stub!(:readable?).with(@filename).and_return true
|
|
63
|
+
@filename.stub!(:read).and_return "spec contents"
|
|
64
|
+
self.stub!(:open).with(@filename).and_return @filename
|
|
65
|
+
end
|
|
66
|
+
it "should call readable on the string sent in to load_pool" do
|
|
67
|
+
lambda {
|
|
68
|
+
::File.should_receive(:readable?).with(@filename).and_return false
|
|
69
|
+
load_pool(@filename)
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
it "should call inflate from Script with the poolspec" do
|
|
73
|
+
PoolParty::Script.should_receive(:inflate).with("spec contents", "myspec.spec")
|
|
74
|
+
load_pool(@filename)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
59
77
|
describe "print" do
|
|
60
78
|
before(:each) do
|
|
61
79
|
reset!
|
|
@@ -25,13 +25,13 @@ describe "Hash" do
|
|
|
25
25
|
@a.to_os.to_hash.should == @a
|
|
26
26
|
end
|
|
27
27
|
it "should not put quotes around integers" do
|
|
28
|
-
{:a => 10, :b => "q"}.flush_out.should == ["a => 10", "b => 'q'"]
|
|
28
|
+
{:a => 10, :b => "q"}.flush_out.sort.should == ["a => 10", "b => 'q'"]
|
|
29
29
|
end
|
|
30
30
|
it "should be able to flush out into a string into an array" do
|
|
31
|
-
@a.flush_out.should == ["a => '10'","b => '20'","c => '30'"]
|
|
31
|
+
@a.flush_out.sort.should == ["a => '10'","b => '20'","c => '30'"]
|
|
32
32
|
end
|
|
33
33
|
it "should be able to flush out with pre and posts" do
|
|
34
|
-
@a.flush_out("hi", "ho").should == ["hia => '10'ho","hib => '20'ho","hic => '30'ho"]
|
|
34
|
+
@a.flush_out("hi", "ho").sort.should == ["hia => '10'ho","hib => '20'ho","hic => '30'ho"]
|
|
35
35
|
end
|
|
36
36
|
describe "select" do
|
|
37
37
|
before(:each) do
|
|
@@ -52,7 +52,7 @@ describe "Hash" do
|
|
|
52
52
|
@rejected_hash.keys.should == [:a]
|
|
53
53
|
end
|
|
54
54
|
it "should return the old array with the other keys" do
|
|
55
|
-
@a.keys.should == [:b, :c]
|
|
55
|
+
@a.keys.sort.should == [:b, :c]
|
|
56
56
|
end
|
|
57
57
|
it "should not throw a fit with an empty hash" do
|
|
58
58
|
lambda {
|
|
@@ -4,6 +4,26 @@ describe "Object" do
|
|
|
4
4
|
it "should respond to to_os" do
|
|
5
5
|
Object.new.respond_to?(:to_os).should == true
|
|
6
6
|
end
|
|
7
|
+
describe "methodable object" do
|
|
8
|
+
before(:each) do
|
|
9
|
+
@obj.stub!(:run).and_return "true"
|
|
10
|
+
end
|
|
11
|
+
it "should run the method :run because it exists" do
|
|
12
|
+
@obj.send_if_method(:run).should == "true"
|
|
13
|
+
end
|
|
14
|
+
it "should not run the method :bah because it doesn't exist" do
|
|
15
|
+
@obj.send_if_method("bah").should == "bah"
|
|
16
|
+
end
|
|
17
|
+
it "should not run the method if it is sent nil" do
|
|
18
|
+
@obj.send_if_method(nil).should == nil
|
|
19
|
+
end
|
|
20
|
+
it "should not run an empty string method" do
|
|
21
|
+
@obj.send_if_method("").should == ""
|
|
22
|
+
end
|
|
23
|
+
it "should not run a method that is an integer" do
|
|
24
|
+
@obj.send_if_method(2).should == 2
|
|
25
|
+
end
|
|
26
|
+
end
|
|
7
27
|
describe "with_options" do
|
|
8
28
|
before(:each) do
|
|
9
29
|
@obj = Class.new
|
|
@@ -36,5 +56,14 @@ describe "Object" do
|
|
|
36
56
|
@b.dude.should == "totally"
|
|
37
57
|
end
|
|
38
58
|
end
|
|
59
|
+
describe "contextual running" do
|
|
60
|
+
before(:each) do
|
|
61
|
+
@obj.stub!(:default_options).and_return {}
|
|
62
|
+
@a = @obj.run_in_context { @a = "hello world" }
|
|
63
|
+
end
|
|
64
|
+
it "should have the method meta_eval" do
|
|
65
|
+
@obj.respond_to?(:meta_eval).should == true
|
|
66
|
+
end
|
|
67
|
+
end
|
|
39
68
|
end
|
|
40
69
|
end
|
|
@@ -115,6 +115,9 @@ listen web_proxy 127.0.0.1:3000
|
|
|
115
115
|
it "should be able to get the top level class" do
|
|
116
116
|
"PoolParty::Resources::File".top_level_class.should == "file"
|
|
117
117
|
end
|
|
118
|
+
it "should turn file into a class" do
|
|
119
|
+
"file".camelcase.should == "File"
|
|
120
|
+
end
|
|
118
121
|
end
|
|
119
122
|
describe "to_option_string" do
|
|
120
123
|
it "should not touch a string, but return the string with single quotes" do
|
|
@@ -147,6 +150,9 @@ listen web_proxy 127.0.0.1:3000
|
|
|
147
150
|
it "should remove the periods from the string" do
|
|
148
151
|
"xnot.org".sanitize.should == "xnotorg"
|
|
149
152
|
end
|
|
153
|
+
it "should be able to turn a string into a dir safe name" do
|
|
154
|
+
"Rails app/".dir_safe.should == "rails_app/"
|
|
155
|
+
end
|
|
150
156
|
end
|
|
151
157
|
describe "nice_runnable" do
|
|
152
158
|
before(:each) do
|
|
@@ -16,8 +16,8 @@ describe "Binary" do
|
|
|
16
16
|
end
|
|
17
17
|
describe "get_existing_spec_location" do
|
|
18
18
|
before(:each) do
|
|
19
|
-
::File.stub!(:
|
|
20
|
-
::File.stub!(:
|
|
19
|
+
::File.stub!(:readable?).and_return false
|
|
20
|
+
::File.stub!(:readable?).with("#{Base.storage_directory}/pool.spec").and_return true
|
|
21
21
|
end
|
|
22
22
|
it "should be a String" do
|
|
23
23
|
Binary.get_existing_spec_location.class.should == String
|
|
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../lib/poolparty/helpers/optioner'
|
|
|
4
4
|
describe "Option Parser" do
|
|
5
5
|
describe "options" do
|
|
6
6
|
before(:each) do
|
|
7
|
-
@op = PoolParty::Optioner.new
|
|
7
|
+
@op = PoolParty::Optioner.new({:abstract => true})
|
|
8
8
|
@op.parse_options
|
|
9
9
|
end
|
|
10
10
|
it "should set the options as an Hash" do
|
|
@@ -17,9 +17,6 @@ describe "Option Parser" do
|
|
|
17
17
|
@op.options.should_receive(:[]).with(:verbose).once.and_return true
|
|
18
18
|
@op.verbose
|
|
19
19
|
end
|
|
20
|
-
it "should be able to display the version" do
|
|
21
|
-
@op.version.should == PoolParty::VERSION::STRING
|
|
22
|
-
end
|
|
23
20
|
it "should exit after displaying the help message" do
|
|
24
21
|
hide_output do
|
|
25
22
|
lambda {
|
|
@@ -91,6 +91,13 @@ describe "ProvisionerBase" do
|
|
|
91
91
|
it "should compound the string to be hello \n \n cruel world" do
|
|
92
92
|
@provisioner.install_string.should == "hello \n \n cruel world"
|
|
93
93
|
end
|
|
94
|
+
it "should call the last_install_tasks last" do
|
|
95
|
+
@provisioner.should_receive(:last_install_tasks).at_least(1).and_return ["pops"]
|
|
96
|
+
end
|
|
97
|
+
it "should append the last_install_tasks to the end" do
|
|
98
|
+
@provisioner.stub!(:last_install_tasks).and_return ["pops"]
|
|
99
|
+
@provisioner.install_string.should == "hello \n \n cruel world \n pops"
|
|
100
|
+
end
|
|
94
101
|
after do
|
|
95
102
|
@provisioner.install_string
|
|
96
103
|
end
|
|
@@ -100,8 +107,14 @@ describe "ProvisionerBase" do
|
|
|
100
107
|
stub_list_from_remote_for(@cloud)
|
|
101
108
|
@cloud.stub!(:keypair).and_return "fake_keypair"
|
|
102
109
|
@cloud.stub!(:keypair_path).and_return "~/.ec2/fake_keypair"
|
|
103
|
-
|
|
110
|
+
@cloud.stub!(:other_clouds).and_return []
|
|
111
|
+
@cloud.stub!(:expand_when).and_return "cpu > 10"
|
|
104
112
|
@cloud.stub!(:copy_file_to_storage_directory).and_return true
|
|
113
|
+
@cloud.stub!(:rsync_storage_files_to).and_return true
|
|
114
|
+
@cloud.stub!(:minimum_runnable_options).and_return []
|
|
115
|
+
Provisioner::Master.stub!(:new).and_return @provisioner
|
|
116
|
+
@provisioner.stub!(:build_and_store_new_config_file).and_return true
|
|
117
|
+
@provisioner.stub!(:process_clean_reconfigure_for!).and_return true
|
|
105
118
|
end
|
|
106
119
|
describe "provision_master" do
|
|
107
120
|
it "should call write_install_file" do
|
|
@@ -27,7 +27,7 @@ describe "Master provisioner" do
|
|
|
27
27
|
@master.should_receive(:setup_fileserver)
|
|
28
28
|
end
|
|
29
29
|
it "should call create_local_node" do
|
|
30
|
-
@master.should_receive(:create_local_node)
|
|
30
|
+
@master.should_receive(:create_local_node).twice
|
|
31
31
|
end
|
|
32
32
|
it "should call the custom_install_tasks" do
|
|
33
33
|
@master.should_receive(:custom_install_tasks)
|
|
@@ -39,8 +39,8 @@ describe "Master provisioner" do
|
|
|
39
39
|
it "should return install_puppet_master as apt-get install puppet factor" do
|
|
40
40
|
@master.install_puppet.should =~ /install -y puppet puppetmaster/
|
|
41
41
|
end
|
|
42
|
-
it "should return setup basic structure" do
|
|
43
|
-
@master.setup_basic_structure.should =~ /
|
|
42
|
+
it "should return setup basic structure and set classes into the manifest" do
|
|
43
|
+
@master.setup_basic_structure.should =~ /echo "import 'classes\/\*\.pp'" >> \/etc\/puppet\/manifests\/site\.pp/
|
|
44
44
|
end
|
|
45
45
|
it "should return setup_fileserver with the setup" do
|
|
46
46
|
@master.setup_fileserver.should =~ /\[files\]/
|
|
@@ -73,7 +73,7 @@ describe "CloudResourcer" do
|
|
|
73
73
|
@tc.respond_to?(:keypair_path).should == true
|
|
74
74
|
end
|
|
75
75
|
it "should set the keypair to the Base.keypair_path" do
|
|
76
|
-
@tc.keypair_path.should =~
|
|
76
|
+
@tc.keypair_path.should =~ /\.ec2\/rangerbob/
|
|
77
77
|
end
|
|
78
78
|
it "should set the keypair to have the keypair set" do
|
|
79
79
|
@tc.keypair.should =~ /rangerbob/
|
|
@@ -98,12 +98,12 @@ describe "CloudResourcer" do
|
|
|
98
98
|
@tc.should_receive(:configure).with(@testparent.options)
|
|
99
99
|
end
|
|
100
100
|
after do
|
|
101
|
-
@tc.
|
|
101
|
+
@tc.run_setup(@testparent)
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
describe "parent's services" do
|
|
105
105
|
before(:each) do
|
|
106
|
-
@tc.
|
|
106
|
+
@tc.run_setup(@testparent)
|
|
107
107
|
end
|
|
108
108
|
it "should set the parent" do
|
|
109
109
|
@tc.parent.should == @testparent
|
|
@@ -9,7 +9,6 @@ describe "configurable" do
|
|
|
9
9
|
@tc = TestClass.new
|
|
10
10
|
end
|
|
11
11
|
it "should set the name as frank" do
|
|
12
|
-
@tc.name.should == nil
|
|
13
12
|
@tc.configure({:name => "frank"})
|
|
14
13
|
@tc.name.should == "frank"
|
|
15
14
|
end
|
|
@@ -23,4 +22,8 @@ describe "configurable" do
|
|
|
23
22
|
@tc.reconfigure(:name => "dewey")
|
|
24
23
|
@tc.name.should == "dewey"
|
|
25
24
|
end
|
|
25
|
+
it "should send an array if two arguments are given" do
|
|
26
|
+
@tc.configure({:name => ["array", "ishere"]})
|
|
27
|
+
@tc.name.should == ["array", "ishere"]
|
|
28
|
+
end
|
|
26
29
|
end
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
class TestMonitorClass
|
|
4
|
+
include PoolParty::Monitors
|
|
5
|
+
include Configurable
|
|
6
|
+
def default_options
|
|
7
|
+
{}
|
|
8
|
+
end
|
|
9
|
+
end
|
|
4
10
|
|
|
5
11
|
describe "Monitors" do
|
|
12
|
+
before(:each) do
|
|
13
|
+
@tmc = TestMonitorClass.new
|
|
14
|
+
end
|
|
6
15
|
it "should have a list of available monitors" do
|
|
7
16
|
PoolParty::Monitors.available_monitors.empty?.should == false
|
|
8
17
|
end
|
|
@@ -11,9 +20,92 @@ describe "Monitors" do
|
|
|
11
20
|
PoolParty::Monitors.register_monitor :fake
|
|
12
21
|
size.should == PoolParty::Monitors.available_monitors.size - 1
|
|
13
22
|
end
|
|
23
|
+
it "should define the mehtod fake when register_monitor :fake" do
|
|
24
|
+
PoolParty::Monitors.register_monitor :fake
|
|
25
|
+
TestMonitorClass.new.respond_to?(:fake).should == true
|
|
26
|
+
end
|
|
27
|
+
it "should call the Messenger with messenger_send!('get_load fake')" do
|
|
28
|
+
@tmc.should_receive(:messenger_send!).with("get_current_load fake").and_return true
|
|
29
|
+
@tmc.fake
|
|
30
|
+
end
|
|
31
|
+
it "should have the cpu method on the class" do
|
|
32
|
+
@tmc.should_receive(:messenger_send!).with("get_current_load cpu").and_return true
|
|
33
|
+
@tmc.cpu
|
|
34
|
+
end
|
|
35
|
+
describe "expansions" do
|
|
36
|
+
before(:each) do
|
|
37
|
+
@tmc = TestMonitorClass.new
|
|
38
|
+
@tmc.instance_eval do
|
|
39
|
+
expand_when "cpu > 95", "memory > 90"
|
|
40
|
+
contract_when "cpu < 15", "memory < 10"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
it "should have the method expand_when as a class method" do
|
|
44
|
+
@tmc.respond_to?(:expand_when).should == true
|
|
45
|
+
end
|
|
46
|
+
it "should have expansions as a collection of rules on the object" do
|
|
47
|
+
@tmc.expand_when.class.should == Aska::Rules
|
|
48
|
+
end
|
|
49
|
+
it "should return the expand_when as a set of rules" do
|
|
50
|
+
@tmc.expand_when.class.should == Aska::Rules
|
|
51
|
+
end
|
|
52
|
+
it "should have the expansion in the array on the instance" do
|
|
53
|
+
@tmc.expand_when.first.should == {"cpu" => [">", "95"]}
|
|
54
|
+
end
|
|
55
|
+
it "should have the memory expansion in the array on the instance" do
|
|
56
|
+
@tmc.expand_when[1].should == {"memory" => [">", "90"]}
|
|
57
|
+
end
|
|
58
|
+
it "should have 2 expansions" do
|
|
59
|
+
@tmc.expand_when.size.should == 2
|
|
60
|
+
end
|
|
61
|
+
it "should give us the method cpu for free" do
|
|
62
|
+
@tmc.respond_to?(:cpu).should == true
|
|
63
|
+
end
|
|
64
|
+
describe "when memory is over the limit" do
|
|
65
|
+
before(:each) do
|
|
66
|
+
@tmc.stub!(:memory).and_return 99
|
|
67
|
+
end
|
|
68
|
+
it "should say it should not expand if the cpu is short of the limit" do
|
|
69
|
+
@tmc.stub!(:cpu).and_return 43
|
|
70
|
+
@tmc.valid_rules?(:expand_when).should == false
|
|
71
|
+
end
|
|
72
|
+
it "should say that it has the valid expansion rules when the cpu is higher than the limit" do
|
|
73
|
+
@tmc.stub!(:cpu).and_return 98
|
|
74
|
+
@tmc.valid_rules?(:expand_when).should == true
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
describe "when cpu is over the limit" do
|
|
78
|
+
before(:each) do
|
|
79
|
+
@tmc.stub!(:cpu).and_return 98
|
|
80
|
+
end
|
|
81
|
+
it "should say it should not expand if the cpu is short of the limit" do
|
|
82
|
+
@tmc.stub!(:memory).and_return 43
|
|
83
|
+
@tmc.valid_rules?(:expand_when).should == false
|
|
84
|
+
end
|
|
85
|
+
it "should say that it has the valid expansion rules when the cpu is higher than the limit" do
|
|
86
|
+
@tmc.stub!(:memory).and_return 98
|
|
87
|
+
@tmc.valid_rules?(:expand_when).should == true
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
describe "when neither is over the limits" do
|
|
91
|
+
before(:each) do
|
|
92
|
+
@tmc.stub!(:cpu).and_return 87
|
|
93
|
+
@tmc.stub!(:memory).and_return 40
|
|
94
|
+
end
|
|
95
|
+
it "should not expand" do
|
|
96
|
+
@tmc.valid_rules?(:expand_when).should == false
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
it "should be able to turn them into a string" do
|
|
100
|
+
@tmc.expand_when.to_s.should == "'cpu > 95', 'memory > 90'"
|
|
101
|
+
end
|
|
102
|
+
it "should be able to turn them into a string with expand_when" do
|
|
103
|
+
@tmc.expand_when.to_s.should == "'cpu > 95', 'memory > 90'"
|
|
104
|
+
end
|
|
105
|
+
end
|
|
14
106
|
end
|
|
15
107
|
describe "BaseMonitor" do
|
|
16
108
|
it "should have the singleton method run defined" do
|
|
17
|
-
BaseMonitor.respond_to?(:run).should == true
|
|
109
|
+
PoolParty::Monitors::BaseMonitor.respond_to?(:run).should == true
|
|
18
110
|
end
|
|
19
111
|
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Monitors
|
|
4
|
+
|
|
5
|
+
def vm_stat_str
|
|
6
|
+
<<-EOE
|
|
7
|
+
Mach Virtual Memory Statistics: (page size of 4096 bytes)
|
|
8
|
+
Pages free: 67993.
|
|
9
|
+
Pages active: 256445.
|
|
10
|
+
Pages inactive: 124392.
|
|
11
|
+
Pages wired down: 73762.
|
|
12
|
+
"Translation faults": 1280661664.
|
|
13
|
+
Pages copy-on-write: 52365921.
|
|
14
|
+
Pages zero filled: 722428360.
|
|
15
|
+
Pages reactivated: 441434.
|
|
16
|
+
Pageins: 1120320.
|
|
17
|
+
Pageouts: 285425.
|
|
18
|
+
Object cache: 11159288 hits of 21753237 lookups (51% hit rate)
|
|
19
|
+
EOE
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "MemoryMonitor" do
|
|
23
|
+
before(:each) do
|
|
24
|
+
@mon = MemoryMonitor.new
|
|
25
|
+
MemoryMonitor.stub!(:new).and_return @mon
|
|
26
|
+
end
|
|
27
|
+
it "should have the singleton method run defined" do
|
|
28
|
+
MemoryMonitor.respond_to?(:run).should == true
|
|
29
|
+
end
|
|
30
|
+
it "should call the method new" do
|
|
31
|
+
MemoryMonitor.should_receive(:new).and_return @mon
|
|
32
|
+
MemoryMonitor.run
|
|
33
|
+
end
|
|
34
|
+
describe "calling" do
|
|
35
|
+
it "should call uname with %x" do
|
|
36
|
+
@mon.should_receive(:`).with("uname").and_return "Darwin"
|
|
37
|
+
@mon.stub!(:`).and_return ""
|
|
38
|
+
end
|
|
39
|
+
it "should call vm_stat with when the uname returns Darwin" do
|
|
40
|
+
@mon.should_receive(:`).with("uname").and_return "Darwin"
|
|
41
|
+
@mon.should_receive(:`).with("vm_stat").and_return vm_stat_str
|
|
42
|
+
end
|
|
43
|
+
after(:each) do
|
|
44
|
+
@mon.run
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -4,11 +4,13 @@ setup_cl
|
|
|
4
4
|
|
|
5
5
|
include PoolParty::Messenger
|
|
6
6
|
|
|
7
|
+
Object.send :undef_method, :messenger_send!
|
|
8
|
+
|
|
7
9
|
describe "Messenger" do
|
|
8
10
|
it "should have the method messenger_send!" do
|
|
9
11
|
Messenger.respond_to?(:messenger_send!).should == true
|
|
10
12
|
end
|
|
11
13
|
it "should call send_cmd on the client" do
|
|
12
|
-
Messenger.messenger_send!('send_cmd ["echo hi"]', true).should =~ /-run pm_client send_cmd/
|
|
14
|
+
hide_output {Messenger.messenger_send!('send_cmd ["echo hi"]', true).should =~ /-run pm_client send_cmd/}
|
|
13
15
|
end
|
|
14
16
|
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
2
|
|
|
3
|
-
include Remote
|
|
3
|
+
# include Remote
|
|
4
4
|
|
|
5
5
|
class TestClass
|
|
6
|
-
include RemoterBase
|
|
6
|
+
include PoolParty::Remote::RemoterBase
|
|
7
7
|
include Ec2
|
|
8
8
|
include CloudResourcer
|
|
9
|
+
include CloudDsl
|
|
9
10
|
|
|
10
11
|
def keypair
|
|
11
12
|
"fake_keypair"
|
|
@@ -13,24 +14,41 @@ class TestClass
|
|
|
13
14
|
|
|
14
15
|
def ami;"ami-abc123";end
|
|
15
16
|
def size; "small";end
|
|
16
|
-
|
|
17
|
+
def verbose
|
|
18
|
+
false
|
|
19
|
+
end
|
|
17
20
|
def ec2
|
|
18
21
|
@ec2 ||= EC2::Base.new( :access_key_id => "not_an_access_key", :secret_access_key => "not_a_secret_access_key")
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
describe "ec2 remote base" do
|
|
22
25
|
before(:each) do
|
|
26
|
+
setup
|
|
23
27
|
@tr = TestClass.new
|
|
24
28
|
stub_remoter_for(@tr)
|
|
25
29
|
@tr.stub!(:get_instances_description).and_return response_list_of_instances
|
|
26
30
|
end
|
|
27
|
-
%w(launch_new_instance! terminate_instance! describe_instance describe_instances).each do |method|
|
|
31
|
+
%w(launch_new_instance! terminate_instance! describe_instance describe_instances create_snapshot).each do |method|
|
|
28
32
|
eval <<-EOE
|
|
29
33
|
it "should have the method #{method}" do
|
|
30
34
|
@tr.respond_to?(:#{method}).should == true
|
|
31
35
|
end
|
|
32
36
|
EOE
|
|
33
37
|
end
|
|
38
|
+
describe "helpers" do
|
|
39
|
+
it "should be able to convert an ec2 ip to a real ip" do
|
|
40
|
+
"ec2-72-44-36-12.compute-1.amazonaws.com".convert_from_ec2_to_ip.should == "72.44.36.12"
|
|
41
|
+
end
|
|
42
|
+
it "should not throw an error if another string is returned" do
|
|
43
|
+
"72.44.36.12".convert_from_ec2_to_ip.should == "72.44.36.12"
|
|
44
|
+
end
|
|
45
|
+
it "should be able to parse the date from the timestamp" do
|
|
46
|
+
"2008-11-13T09:33:09+0000".parse_datetime.should == DateTime.parse("2008-11-13T09:33:09+0000")
|
|
47
|
+
end
|
|
48
|
+
it "should rescue itself and just return the string if it fails" do
|
|
49
|
+
"thisisthedate".parse_datetime.should == "thisisthedate"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
34
52
|
describe "launching" do
|
|
35
53
|
before(:each) do
|
|
36
54
|
@tr.ec2.stub!(:run_instances).and_return true
|
|
@@ -39,8 +57,17 @@ describe "ec2 remote base" do
|
|
|
39
57
|
@tr.ec2.should_receive(:run_instances).and_return true
|
|
40
58
|
@tr.launch_new_instance!
|
|
41
59
|
end
|
|
60
|
+
it "should use a specific security group if one is specified" do
|
|
61
|
+
@tr.stub!(:security_group).and_return "web"
|
|
62
|
+
@tr.ec2.should_receive(:run_instances).with(hash_including(:group_id => ['web'])).and_return true
|
|
63
|
+
@tr.launch_new_instance!
|
|
64
|
+
end
|
|
65
|
+
it "should use the default security group if none is specified" do
|
|
66
|
+
@tr.ec2.should_receive(:run_instances).with(hash_including(:group_id => ['default'])).and_return true
|
|
67
|
+
@tr.launch_new_instance!
|
|
68
|
+
end
|
|
42
69
|
it "should get the hash response from EC2ResponseObject" do
|
|
43
|
-
EC2ResponseObject.should_receive(:get_hash_from_response).
|
|
70
|
+
EC2ResponseObject.should_receive(:get_hash_from_response).and_return true
|
|
44
71
|
@tr.launch_new_instance!
|
|
45
72
|
end
|
|
46
73
|
end
|
|
@@ -89,4 +116,18 @@ describe "ec2 remote base" do
|
|
|
89
116
|
@tr.create_keypair
|
|
90
117
|
end
|
|
91
118
|
end
|
|
119
|
+
describe "create_snapshot" do
|
|
120
|
+
# We can assume that create_snapshot on the ec2 gem works
|
|
121
|
+
before(:each) do
|
|
122
|
+
@tr.ec2.stub!(:create_snapshot).and_return nil
|
|
123
|
+
end
|
|
124
|
+
it "should create a snapshot of the current EBS volume" do
|
|
125
|
+
@tr.ec2.stub!(:create_snapshot).and_return {{"snapshotId" => "snap-123"}}
|
|
126
|
+
@tr.stub!(:ebs_volume_id).and_return "vol-123"
|
|
127
|
+
@tr.create_snapshot.should == {"snapshotId" => "snap-123"}
|
|
128
|
+
end
|
|
129
|
+
it "should not create a snapshot if there is no EBS volume" do
|
|
130
|
+
@tr.create_snapshot.should == nil
|
|
131
|
+
end
|
|
132
|
+
end
|
|
92
133
|
end
|
|
@@ -4,6 +4,7 @@ include Remote
|
|
|
4
4
|
|
|
5
5
|
describe "Remote Instance" do
|
|
6
6
|
before(:each) do
|
|
7
|
+
setup
|
|
7
8
|
@valid_hash = {:ip => "127.0.0.1", :name => "master", :responding => "true"}
|
|
8
9
|
end
|
|
9
10
|
describe "configurable" do
|
|
@@ -69,7 +70,7 @@ describe "Remote Instance" do
|
|
|
69
70
|
@ri.respond_to?(:puppet_runner_command).should == true
|
|
70
71
|
end
|
|
71
72
|
it "should return the puppet_runner_command with puppetd" do
|
|
72
|
-
@ri.puppet_runner_command.should =~ /
|
|
73
|
+
@ri.puppet_runner_command.should =~ /puppetrun/
|
|
73
74
|
end
|
|
74
75
|
end
|
|
75
76
|
end
|