fairchild-poolparty 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +0 -12
- data/Rakefile +17 -1
- data/VERSION.yml +1 -1
- data/bin/cloud +20 -1
- data/bin/cloud-bootstrap +14 -4
- data/bin/cloud-configure +26 -9
- data/bin/cloud-contract +7 -7
- data/bin/cloud-describe +28 -0
- data/bin/cloud-expand +13 -6
- data/bin/cloud-list +3 -5
- data/bin/cloud-osxcopy +1 -1
- data/bin/cloud-provision +1 -1
- data/bin/cloud-show +6 -5
- data/bin/cloud-ssh +1 -3
- data/bin/cloud-start +8 -6
- data/bin/cloud-terminate +9 -7
- data/bin/server-cloud-elections +29 -18
- data/bin/server-ensure-provisioning +24 -29
- data/bin/server-list-active +10 -5
- data/bin/server-monitor.ru +18 -1
- data/bin/server-update-hosts +3 -3
- data/bin/server-write-new-nodes +1 -1
- data/config/jeweler.rb +12 -3
- data/lib/poolparty/aska/aska.rb +1 -12
- data/lib/poolparty/base_packages/haproxy.rb +26 -18
- data/lib/poolparty/base_packages/poolparty.rb +1 -1
- data/lib/poolparty/capistrano.rb +1 -1
- data/lib/poolparty/core/array.rb +12 -0
- data/lib/poolparty/core/hash.rb +12 -5
- data/lib/poolparty/core/nil.rb +8 -0
- data/lib/poolparty/core/object.rb +15 -5
- data/lib/poolparty/core/string.rb +28 -2
- data/lib/poolparty/dependency_resolver/chef_resolver.rb +106 -79
- data/lib/poolparty/dependency_resolver/dependency_resolver.rb +1 -1
- data/lib/poolparty/dependency_resolver/dependency_resolver_cloud_extensions.rb +5 -4
- data/lib/poolparty/dependency_resolver/puppet_resolver.rb +44 -17
- data/lib/poolparty/helpers/console.rb +1 -1
- data/lib/poolparty/helpers/optioner.rb +9 -2
- data/lib/poolparty/lite.rb +12 -2
- data/lib/poolparty/modules/callbacks.rb +44 -0
- data/lib/poolparty/modules/cloud_dsl.rb +17 -11
- data/lib/poolparty/modules/cloud_resourcer.rb +29 -21
- data/lib/poolparty/modules/definable_resource.rb +1 -1
- data/lib/poolparty/modules/pinger.rb +28 -0
- data/lib/poolparty/modules/resourcing_dsl.rb +7 -3
- data/lib/poolparty/modules/thread_pool.rb +107 -106
- data/lib/poolparty/modules/user_helpers.rb +20 -0
- data/lib/poolparty/monitors/base_monitor.rb +32 -81
- data/lib/poolparty/monitors/monitor_rack.rb +60 -69
- data/lib/poolparty/monitors/monitors/favicon_monitor.rb +12 -0
- data/lib/poolparty/monitors/monitors/load_monitor.rb +9 -15
- data/lib/poolparty/monitors/monitors/memory_monitor.rb +48 -48
- data/lib/poolparty/monitors/monitors/neighborhood_monitor.rb +77 -0
- data/lib/poolparty/monitors/{stats_monitor.rb → monitors/stats_monitor.rb} +29 -24
- data/lib/poolparty/monitors/monitors/time_monitor.rb +15 -0
- data/lib/poolparty/net/messenger.rb +2 -0
- data/lib/poolparty/net/remoter/cloud_control.rb +177 -227
- data/lib/poolparty/net/remoter/connections.rb +10 -18
- data/lib/poolparty/net/remoter/interactive.rb +24 -90
- data/lib/poolparty/net/remoter_base.rb +98 -25
- data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +83 -66
- data/lib/poolparty/net/remoter_bases/vmrun/utilities/vm_disk.rb +12 -0
- data/lib/poolparty/net/remoter_bases/vmrun/utilities/vmx.rb +33 -0
- data/lib/poolparty/net/remoter_bases/vmrun/utilities/vmx_file.rb +117 -0
- data/lib/poolparty/net/remoter_bases/vmrun/vmrun.rb +165 -0
- data/lib/poolparty/net/remoter_bases/vmrun/vmrun_instance.rb +71 -0
- data/lib/poolparty/{base_packages → plugins}/bind.rb +1 -1
- data/lib/poolparty/plugins/chef.rb +71 -71
- data/lib/poolparty/plugins/chef_deploy.rb +58 -0
- data/lib/poolparty/plugins/{deploydirectory.rb → deploy_directory.rb} +12 -3
- data/lib/poolparty/plugins/dynomite.rb +14 -0
- data/lib/poolparty/plugins/gem_package.rb +37 -0
- data/lib/poolparty/plugins/line_in_file.rb +1 -0
- data/lib/poolparty/plugins/nanite.rb +41 -0
- data/lib/poolparty/{base_packages → plugins}/tokyo_tyrant.rb +1 -1
- data/lib/poolparty/poolparty/cloud.rb +36 -35
- data/lib/poolparty/poolparty/default.rb +2 -11
- data/lib/poolparty/poolparty/key.rb +15 -12
- data/lib/poolparty/poolparty/neighborhoods.rb +54 -21
- data/lib/poolparty/poolparty/plugin.rb +6 -9
- data/lib/poolparty/poolparty/plugin_model.rb +5 -5
- data/lib/poolparty/poolparty/pool.rb +8 -4
- data/lib/poolparty/poolparty/poolparty_base_class.rb +20 -11
- data/lib/poolparty/poolparty/resource.rb +9 -5
- data/lib/poolparty/poolparty/service.rb +3 -1
- data/lib/poolparty/provision/boot_strapper.rb +47 -24
- data/lib/poolparty/provision/configurations/chef.rb +7 -4
- data/lib/poolparty/provision/dr_configure.rb +80 -25
- data/lib/poolparty/resources/cron.rb +8 -0
- data/lib/poolparty/resources/directory.rb +1 -1
- data/lib/poolparty/resources/file.rb +16 -0
- data/lib/poolparty/resources/package.rb +7 -2
- data/lib/poolparty/resources/service.rb +4 -3
- data/lib/poolparty/resources/symlink.rb +0 -8
- data/lib/poolparty/schema.rb +35 -20
- data/lib/poolparty/templates/haproxy.conf +27 -25
- data/lib/poolparty/templates/monitor.ru +3 -3
- data/lib/poolparty/verification/verifier_base.rb +17 -0
- data/lib/poolparty/verification/verifiers/ping.rb +17 -0
- data/lib/poolparty/verification/verify.rb +74 -0
- data/lib/poolparty.rb +8 -9
- data/lib/poolpartycl.rb +14 -0
- data/spec/bin/server-list-active_spec.rb +2 -0
- data/spec/poolparty/base_packages/haproxy_spec.rb +1 -1
- data/spec/poolparty/core/array_spec.rb +3 -1
- data/spec/poolparty/core/ordered_hash_spec.rb +2 -2
- data/spec/poolparty/dependency_resolver/chef_resolver_spec.rb +9 -15
- data/spec/poolparty/dependency_resolver/dependency_resolver_cloud_extensions_spec.rb +6 -6
- data/spec/poolparty/dependency_resolver/puppet_resolver_spec.rb +121 -124
- data/spec/poolparty/net/remote_spec.rb +287 -286
- data/spec/poolparty/net/remoter_bases/ec2_mocks_and_stubs.rb +1 -1
- data/spec/poolparty/net/remoter_bases/ec2_remote_instance_spec.rb +7 -8
- data/spec/poolparty/net/remoter_bases/ec2_spec.rb +22 -7
- data/spec/poolparty/net/remoter_spec.rb +48 -45
- data/spec/poolparty/poolparty/cloud_spec.rb +15 -22
- data/spec/poolparty/poolparty/key_spec.rb +4 -4
- data/spec/poolparty/poolparty/neighborhoods_spec.rb +1 -2
- data/spec/poolparty/poolparty/plugin_spec.rb +2 -2
- data/spec/poolparty/poolparty/resource_spec.rb +4 -5
- data/spec/poolparty/poolparty_base_class_spec.rb +82 -78
- data/spec/poolparty/resources/package_spec.rb +0 -3
- data/spec/poolparty/spec_helper.rb +4 -4
- data/tasks/development.rake +9 -0
- data/test/poolparty/core/array_test.rb +21 -0
- data/test/poolparty/core/hash_test.rb +14 -1
- data/test/poolparty/core/string_test.rb +29 -0
- data/test/poolparty/dependency_resolver/puppet_resolver_test.rb +106 -0
- data/test/poolparty/modules/callbacks_test.rb +40 -0
- data/test/poolparty/modules/cloud_dsl_test.rb +25 -0
- data/test/poolparty/net/remoter_bases/vmrun/vmrun_test.rb +50 -0
- data/test/poolparty/net/remoter_test.rb +14 -0
- data/test/poolparty/poolparty/neighborhood_test.rb +23 -0
- data/test/poolparty/poolparty/poolparty_base_class_test.rb +84 -0
- data/test/poolparty/verification/verify_test.rb +49 -0
- data/test/test_helper.rb +4 -1
- data/test/test_poolparty.rb +6 -5
- data/vendor/chef/apache2/attributes/apache.rb +1 -1
- data/vendor/chef/apache2/templates/default/default-site.erb +1 -1
- data/vendor/chef/chef-deploy/LICENSE +201 -0
- data/vendor/chef/chef-deploy/README.rdoc +24 -0
- data/vendor/chef/chef-deploy/Rakefile +57 -0
- data/vendor/chef/chef-deploy/TODO +4 -0
- data/vendor/chef/chef-deploy/lib/chef-deploy/cached_deploy.rb +230 -0
- data/vendor/chef/chef-deploy/lib/chef-deploy/git.rb +132 -0
- data/vendor/chef/chef-deploy/lib/chef-deploy/subversion.rb +98 -0
- data/vendor/chef/chef-deploy/lib/chef-deploy.rb +183 -0
- metadata +57 -252
- data/bin/cloud-run +0 -18
- data/bin/cloud-stats +0 -17
- data/bin/ec2-list-active +0 -24
- data/bin/pool +0 -31
- data/bin/pool-describe +0 -8
- data/bin/pool-generate +0 -18
- data/bin/pool-init +0 -28
- data/bin/pool-list +0 -30
- data/bin/pool-start +0 -26
- data/bin/server-list-instances +0 -15
- data/lib/erlang/messenger/Emakefile +0 -1
- data/lib/erlang/messenger/Makefile +0 -15
- data/lib/erlang/messenger/README +0 -5
- data/lib/erlang/messenger/Rakefile +0 -72
- data/lib/erlang/messenger/control +0 -11
- data/lib/erlang/messenger/ebin/client.app +0 -19
- data/lib/erlang/messenger/ebin/master.app +0 -19
- data/lib/erlang/messenger/ebin/node.app +0 -19
- data/lib/erlang/messenger/ebin/packager.app +0 -19
- data/lib/erlang/messenger/ebin/pm_client_rel-0.1.rel +0 -1
- data/lib/erlang/messenger/ebin/pm_master_rel-0.1.rel +0 -1
- data/lib/erlang/messenger/ebin/pm_node_rel-0.1.rel +0 -1
- data/lib/erlang/messenger/include/defines.hrl +0 -27
- data/lib/erlang/messenger/lib/eunit/AUTHORS +0 -2
- data/lib/erlang/messenger/lib/eunit/CHANGELOG +0 -14
- data/lib/erlang/messenger/lib/eunit/COPYING +0 -504
- data/lib/erlang/messenger/lib/eunit/Makefile +0 -28
- data/lib/erlang/messenger/lib/eunit/NOTES +0 -276
- data/lib/erlang/messenger/lib/eunit/README +0 -3
- data/lib/erlang/messenger/lib/eunit/doc/edoc-info +0 -3
- data/lib/erlang/messenger/lib/eunit/doc/erlang.png +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/eunit.html +0 -172
- data/lib/erlang/messenger/lib/eunit/doc/index.html +0 -17
- data/lib/erlang/messenger/lib/eunit/doc/modules-frame.html +0 -12
- data/lib/erlang/messenger/lib/eunit/doc/overview-summary.html +0 -984
- data/lib/erlang/messenger/lib/eunit/doc/overview.edoc +0 -980
- data/lib/erlang/messenger/lib/eunit/doc/packages-frame.html +0 -11
- data/lib/erlang/messenger/lib/eunit/doc/stylesheet.css +0 -55
- 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.app +0 -21
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.appup +0 -1
- 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/examples/eunit_examples.erl +0 -339
- data/lib/erlang/messenger/lib/eunit/examples/fib.erl +0 -19
- data/lib/erlang/messenger/lib/eunit/examples/tests.txt +0 -1
- data/lib/erlang/messenger/lib/eunit/include/eunit.hrl +0 -313
- data/lib/erlang/messenger/lib/eunit/src/Makefile +0 -46
- data/lib/erlang/messenger/lib/eunit/src/autoload.erl +0 -388
- data/lib/erlang/messenger/lib/eunit/src/code_monitor.erl +0 -243
- data/lib/erlang/messenger/lib/eunit/src/eunit.app.src +0 -21
- data/lib/erlang/messenger/lib/eunit/src/eunit.appup.src +0 -1
- data/lib/erlang/messenger/lib/eunit/src/eunit.erl +0 -196
- data/lib/erlang/messenger/lib/eunit/src/eunit_autoexport.erl +0 -102
- data/lib/erlang/messenger/lib/eunit/src/eunit_data.erl +0 -798
- data/lib/erlang/messenger/lib/eunit/src/eunit_internal.hrl +0 -48
- data/lib/erlang/messenger/lib/eunit/src/eunit_lib.erl +0 -682
- data/lib/erlang/messenger/lib/eunit/src/eunit_proc.erl +0 -552
- data/lib/erlang/messenger/lib/eunit/src/eunit_serial.erl +0 -157
- data/lib/erlang/messenger/lib/eunit/src/eunit_server.erl +0 -340
- data/lib/erlang/messenger/lib/eunit/src/eunit_striptests.erl +0 -64
- data/lib/erlang/messenger/lib/eunit/src/eunit_test.erl +0 -334
- data/lib/erlang/messenger/lib/eunit/src/eunit_tests.erl +0 -45
- data/lib/erlang/messenger/lib/eunit/src/eunit_tty.erl +0 -272
- data/lib/erlang/messenger/lib/eunit/src/file_monitor.erl +0 -409
- data/lib/erlang/messenger/lib/eunit/sys.config +0 -9
- data/lib/erlang/messenger/lib/eunit/vsn.mk +0 -1
- data/lib/erlang/messenger/pm_client_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_client_rel-0.1.script +0 -238
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +0 -239
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +0 -237
- data/lib/erlang/messenger/src/client_app.erl +0 -39
- data/lib/erlang/messenger/src/client_server.erl +0 -60
- data/lib/erlang/messenger/src/master_app.erl +0 -39
- data/lib/erlang/messenger/src/node_app.erl +0 -39
- data/lib/erlang/messenger/src/pm_client.erl +0 -49
- data/lib/erlang/messenger/src/pm_client_supervisor.erl +0 -38
- data/lib/erlang/messenger/src/pm_cluster.erl +0 -61
- data/lib/erlang/messenger/src/pm_event_manager.erl +0 -27
- data/lib/erlang/messenger/src/pm_master.erl +0 -215
- data/lib/erlang/messenger/src/pm_master_event_handler.erl +0 -72
- data/lib/erlang/messenger/src/pm_master_supervisor.erl +0 -39
- data/lib/erlang/messenger/src/pm_node.erl +0 -200
- data/lib/erlang/messenger/src/pm_node_supervisor.erl +0 -38
- data/lib/erlang/messenger/src/pm_packager.erl +0 -76
- data/lib/erlang/messenger/src/pm_spawner.erl +0 -213
- data/lib/erlang/messenger/src/pm_strings.erl +0 -11
- data/lib/erlang/messenger/src/utils.erl +0 -72
- data/lib/erlang/messenger/useful_snippets +0 -17
- data/lib/poolparty/monitors/monitors/server_monitor.rb +0 -7
- data/lib/poolparty/monitors/monitors/web_monitor.rb +0 -18
- data/lib/poolparty/monitors/neighborhood_monitor.rb +0 -24
- data/lib/poolparty/monitors.rb +0 -6
- data/lib/poolparty/net/remoter/lists.rb +0 -12
- data/lib/poolparty/poolparty/custom_resource.rb +0 -45
- data/lib/poolparty/resources/custom_service.rb +0 -30
- data/lib/poolparty/services/gem_package.rb +0 -52
- data/lib/poolparty/version.rb +0 -15
- data/spec/poolparty/plugins/svn_spec.rb +0 -16
- data/spec/poolparty/poolparty/custom_resource_spec.rb +0 -79
- data/vendor/gems/butterfly/History.txt +0 -4
- data/vendor/gems/butterfly/PostInstall.txt +0 -2
- data/vendor/gems/butterfly/README.rdoc +0 -48
- data/vendor/gems/butterfly/Rakefile +0 -62
- data/vendor/gems/butterfly/VERSION.yml +0 -4
- data/vendor/gems/butterfly/bin/flutter +0 -4
- data/vendor/gems/butterfly/butterfly.gemspec +0 -37
- data/vendor/gems/butterfly/examples/config.ru +0 -15
- data/vendor/gems/butterfly/examples/my_app.rb +0 -12
- data/vendor/gems/butterfly/lib/butterfly.rb +0 -14
- data/vendor/gems/butterfly/lib/handler.rb +0 -48
- data/vendor/gems/butterfly/lib/request.rb +0 -29
- data/vendor/gems/butterfly/lib/response.rb +0 -49
- data/vendor/gems/butterfly/script/console +0 -10
- data/vendor/gems/butterfly/script/destroy +0 -14
- data/vendor/gems/butterfly/script/generate +0 -14
- data/vendor/gems/butterfly/test/test_adapter_base.rb +0 -23
- data/vendor/gems/butterfly/test/test_butterfly_request.rb +0 -46
- data/vendor/gems/butterfly/test/test_butterfly_response.rb +0 -43
- data/vendor/gems/butterfly/test/test_butterfly_server.rb +0 -16
- data/vendor/gems/butterfly/test/test_default.rb +0 -12
- data/vendor/gems/butterfly/test/test_helper.rb +0 -6
- data/vendor/gems/dslify/History.txt +0 -4
- data/vendor/gems/dslify/Manifest.txt +0 -25
- data/vendor/gems/dslify/PostInstall.txt +0 -5
- data/vendor/gems/dslify/README.txt +0 -60
- data/vendor/gems/dslify/Rakefile +0 -56
- data/vendor/gems/dslify/config/hoe.rb +0 -73
- data/vendor/gems/dslify/config/requirements.rb +0 -15
- data/vendor/gems/dslify/dslify.gemspec +0 -40
- data/vendor/gems/dslify/lib/dslify/dslify.rb +0 -69
- data/vendor/gems/dslify/lib/dslify/version.rb +0 -10
- data/vendor/gems/dslify/lib/dslify.rb +0 -7
- data/vendor/gems/dslify/script/console +0 -10
- data/vendor/gems/dslify/script/destroy +0 -14
- data/vendor/gems/dslify/script/generate +0 -14
- data/vendor/gems/dslify/script/txt2html +0 -82
- data/vendor/gems/dslify/setup.rb +0 -1585
- data/vendor/gems/dslify/tasks/deployment.rake +0 -34
- data/vendor/gems/dslify/tasks/environment.rake +0 -7
- data/vendor/gems/dslify/tasks/website.rake +0 -17
- data/vendor/gems/dslify/test/test_dslify.rb +0 -114
- data/vendor/gems/dslify/website/index.html +0 -86
- data/vendor/gems/dslify/website/index.txt +0 -83
- data/vendor/gems/dslify/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/vendor/gems/dslify/website/stylesheets/screen.css +0 -138
- data/vendor/gems/dslify/website/template.html.erb +0 -48
- data/vendor/gems/parenting/History.txt +0 -4
- data/vendor/gems/parenting/Manifest.txt +0 -13
- data/vendor/gems/parenting/PostInstall.txt +0 -2
- data/vendor/gems/parenting/README.rdoc +0 -47
- data/vendor/gems/parenting/Rakefile +0 -28
- data/vendor/gems/parenting/lib/parenting/base.rb +0 -65
- data/vendor/gems/parenting/lib/parenting.rb +0 -10
- data/vendor/gems/parenting/parenting.gemspec +0 -39
- data/vendor/gems/parenting/script/console +0 -10
- data/vendor/gems/parenting/script/destroy +0 -14
- data/vendor/gems/parenting/script/generate +0 -14
- data/vendor/gems/parenting/test/file_to_eval.rb +0 -9
- data/vendor/gems/parenting/test/test_helper.rb +0 -5
- data/vendor/gems/parenting/test/test_parenting.rb +0 -89
- data/vendor/gems/suitcase/LICENSE +0 -20
- data/vendor/gems/suitcase/README.rdoc +0 -31
- data/vendor/gems/suitcase/Rakefile +0 -57
- data/vendor/gems/suitcase/VERSION.yml +0 -4
- data/vendor/gems/suitcase/lib/suitcase/unzipper.rb +0 -15
- data/vendor/gems/suitcase/lib/suitcase/zipper.rb +0 -119
- data/vendor/gems/suitcase/lib/suitcase.rb +0 -5
- data/vendor/gems/suitcase/suitcase.gemspec +0 -32
- data/vendor/gems/suitcase/test/suitcase_test.rb +0 -102
- data/vendor/gems/suitcase/test/test_dir/box.rb +0 -1
- data/vendor/gems/suitcase/test/test_dir/test.txt +0 -1
- data/vendor/gems/suitcase/test/test_helper.rb +0 -12
@@ -4,8 +4,8 @@ require File.dirname(__FILE__) + '/ec2_mocks_and_stubs.rb'
|
|
4
4
|
|
5
5
|
describe "ec2 remote base" do
|
6
6
|
before(:each) do
|
7
|
-
|
8
|
-
@tr = TestEC2Class.new
|
7
|
+
@cloud = TestCloud.new :test_remoter_base_cloud
|
8
|
+
@tr = TestEC2Class.new(@cloud)
|
9
9
|
stub_remoter_for(@tr)
|
10
10
|
# @tr.stub!(:get_instances_description).and_return response_list_of_instances
|
11
11
|
end
|
@@ -33,7 +33,7 @@ describe "ec2 remote base" do
|
|
33
33
|
describe "launching" do
|
34
34
|
before(:each) do
|
35
35
|
@ret_hash = {:instance_id => "1", :name => "instance"}
|
36
|
-
@tr.ec2.stub!(:run_instances).and_return @ret_hash
|
36
|
+
@tr.ec2({}).stub!(:run_instances).and_return @ret_hash
|
37
37
|
end
|
38
38
|
it "should call run_instances on the ec2 Base class when asking to launch_new_instance!" do
|
39
39
|
# @tr.ec2.should_receive(:run_instances).and_return true
|
@@ -44,10 +44,10 @@ describe "ec2 remote base" do
|
|
44
44
|
@tr.ec2.should_receive(:run_instances).and_return @ret_hash
|
45
45
|
@tr.launch_new_instance!
|
46
46
|
end
|
47
|
-
it "should use the default security group if none is specified" do
|
48
|
-
|
49
|
-
|
50
|
-
end
|
47
|
+
# it "should use the default security group if none is specified" do
|
48
|
+
# @tr.ec2.should_receive(:run_instances).with(hash_including(:group_id => ['default'])).and_return @ret_hash
|
49
|
+
# @tr.launch_new_instance!
|
50
|
+
# end
|
51
51
|
it "should get the hash response from EC2ResponseObject" do
|
52
52
|
EC2ResponseObject.should_receive(:get_hash_from_response).and_return @ret_hash
|
53
53
|
@tr.launch_new_instance! :keypair => "keys"
|
@@ -82,6 +82,21 @@ describe "ec2 remote base" do
|
|
82
82
|
@tr.describe_instances[2][:name].should == "node2"
|
83
83
|
end
|
84
84
|
end
|
85
|
+
describe "elastic_ips" do
|
86
|
+
before(:each) do
|
87
|
+
@resp = {"requestId"=>"be9bd2e9-4f8c-448f-993d-c21fe537e322", "addressesSet"=>{"item"=>[{"instanceId"=>nil, "publicIp"=>"174.129.212.93"}, {"instanceId"=>nil, "publicIp"=>"182.199.200.201"}]}, "xmlns"=>"http://ec2.amazonaws.com/doc/2008-12-01/"}
|
88
|
+
@tr.ec2.stub!(:describe_addresses).and_return @resp
|
89
|
+
end
|
90
|
+
it "should have the next available elastic_ip" do
|
91
|
+
@tr.next_unused_elastic_ip.should == "174.129.212.93"
|
92
|
+
end
|
93
|
+
it "should use only the elastic ips set on the cloud" do
|
94
|
+
@cloud.stub!(:elastic_ips?).and_return true
|
95
|
+
@cloud.stub!(:elastic_ips).and_return ["182.199.200.201"]
|
96
|
+
@tr.stub!(:cloud).and_return @cloud
|
97
|
+
@tr.next_unused_elastic_ip.should == "182.199.200.201"
|
98
|
+
end
|
99
|
+
end
|
85
100
|
describe "create_keypair" do
|
86
101
|
before(:each) do
|
87
102
|
Kernel.stub!(:system).with("ec2-add-keypair fake_keypair > #{Default.base_keypair_path}/id_rsa-fake_keypair && chmod 600 #{Default.base_keypair_path}/id_rsa-fake_keypair").and_return true
|
@@ -45,7 +45,7 @@ describe "Remoter" do
|
|
45
45
|
# @tc.stub!(:maximum_instances).and_return 5
|
46
46
|
# @tc.stub!(:list_of_pending_instances).and_return []
|
47
47
|
# @tc.stub!(:list_of_nonterminated_instances).and_return []
|
48
|
-
# @tc.stub!(:
|
48
|
+
# @tc.stub!(:nodes(:status => "running")).and_return []
|
49
49
|
# @tc.stub!(:master).and_return ris.first
|
50
50
|
# @tc.stub!(:after_launched).and_return true
|
51
51
|
# @tc.stub!(:verbose).and_return false
|
@@ -82,49 +82,52 @@ describe "Remoter" do
|
|
82
82
|
# end
|
83
83
|
# end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
85
|
+
# TODO: Move to test unit
|
86
|
+
# describe "expansions and contractions" do
|
87
|
+
# before(:each) do
|
88
|
+
# @tc = TestClass.new
|
89
|
+
# @tc.stub!(:nodes).and_return({:ip => "127.0.0.2", :status => "running"},
|
90
|
+
# {:ip => "127.0.0.2", :status => "running"})
|
91
|
+
# stub_running_remote_instances @tc
|
92
|
+
# end
|
93
|
+
# describe "list_of_nodes_exceeding_minimum_runtime" do
|
94
|
+
# before(:each) do
|
95
|
+
# @tc.stub!(:minimum_runtime).and_return 3000
|
96
|
+
# end
|
97
|
+
# it "should not be empty" do
|
98
|
+
# @tc.nodes(:status => "running").size.should == 2
|
99
|
+
# @tc.nodes(:status => "running").first.elapsed_runtime.should be > 3000
|
100
|
+
# @tc.list_of_nodes_exceeding_minimum_runtime.size.should be > 0
|
101
|
+
# end
|
102
|
+
# it "should return a RemoteInstance" do
|
103
|
+
# @tc.list_of_nodes_exceeding_minimum_runtime.first.should be_instance_of(PoolParty::Remote::RemoteInstance)
|
104
|
+
# end
|
105
|
+
# it "are_any_nodes_exceeding_minimum_runtime? should be true" do
|
106
|
+
# @tc.are_any_nodes_exceeding_minimum_runtime?.should == true
|
107
|
+
# end
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
# describe "are_too_few_instances_running?" do
|
111
|
+
# it "should be false if the number of running instances is larger than the minimum instances" do
|
112
|
+
# @tc.stub!(:minimum_instances).and_return 1
|
113
|
+
# @tc.are_too_few_instances_running?.should == false
|
114
|
+
# end
|
115
|
+
# it "should be true if the number of running instances is smaller than the minimum instances" do
|
116
|
+
# @tc.stub!(:minimum_instances).and_return 5
|
117
|
+
# @tc.are_too_few_instances_running?.should == true
|
118
|
+
# end
|
119
|
+
# end
|
120
|
+
# describe "are_too_many_instances_running?" do
|
121
|
+
# it "should be true if the number of running instances is larger than the maximum instances" do
|
122
|
+
# @tc.stub!(:maximum_instances).and_return 1
|
123
|
+
# p @tc.nodes
|
124
|
+
# @tc.are_too_many_instances_running?.should == true
|
125
|
+
# end
|
126
|
+
# it "should be false if the number of running instances is smaller than the maximum instances" do
|
127
|
+
# @tc.stub!(:maximum_instances).and_return 5
|
128
|
+
# @tc.are_too_many_instances_running?.should == false
|
129
|
+
# end
|
130
|
+
# end
|
131
|
+
# end
|
129
132
|
|
130
133
|
end
|
@@ -104,7 +104,7 @@ describe "Cloud" do
|
|
104
104
|
@cloud.services.class.should == OrderedHash
|
105
105
|
end
|
106
106
|
it "should have no services (other than the base ones) in the array when there are no services defined" do
|
107
|
-
@cloud.services.size.should
|
107
|
+
@cloud.services.size.should > 2
|
108
108
|
end
|
109
109
|
it "should respond to a options method (from Dslify)" do
|
110
110
|
@cloud.respond_to?(:options).should == true
|
@@ -171,10 +171,9 @@ describe "Cloud" do
|
|
171
171
|
keypair "ney"
|
172
172
|
cloud :app do
|
173
173
|
end
|
174
|
-
end
|
174
|
+
end
|
175
175
|
clouds[:app]._keypairs.first.stub!(:exists?).and_return true
|
176
|
-
clouds[:app]._keypairs.
|
177
|
-
clouds[:app].keypair.full_filepath.should == "ney"
|
176
|
+
clouds[:app]._keypairs.size.should == 2
|
178
177
|
end
|
179
178
|
it "should default to ~/.ssh/id_rsa if none are defined" do
|
180
179
|
File.stub!(:exists?).with("#{ENV["HOME"]}/.ssh/id_rsa").and_return(true)
|
@@ -195,6 +194,7 @@ describe "Cloud" do
|
|
195
194
|
hello my lady
|
196
195
|
EOE
|
197
196
|
end
|
197
|
+
enable :haproxy
|
198
198
|
has_gempackage(:name => "poolparty")
|
199
199
|
has_package(:name => "dummy")
|
200
200
|
end
|
@@ -204,8 +204,8 @@ describe "Cloud" do
|
|
204
204
|
@cloud.respond_to?(:build_manifest).should == true
|
205
205
|
end
|
206
206
|
it "should make a new 'haproxy' class" do
|
207
|
-
|
208
|
-
@cloud.
|
207
|
+
@cloud.should_receive(:haproxy)
|
208
|
+
@cloud.add_optional_enabled_services
|
209
209
|
end
|
210
210
|
it "should have 3 resources" do
|
211
211
|
@cloud.add_poolparty_base_requirements
|
@@ -213,7 +213,7 @@ describe "Cloud" do
|
|
213
213
|
end
|
214
214
|
it "should receive add_poolparty_base_requirements before building the manifest" do
|
215
215
|
@cloud.should_receive(:add_poolparty_base_requirements).once
|
216
|
-
@cloud.
|
216
|
+
@cloud.before_create
|
217
217
|
end
|
218
218
|
after(:each) do
|
219
219
|
context_stack.pop
|
@@ -226,17 +226,8 @@ describe "Cloud" do
|
|
226
226
|
end
|
227
227
|
@hb = PoolpartyBaseHeartbeatClass.new
|
228
228
|
end
|
229
|
-
it "should call initialize on heartbeat (in add_poolparty_base_requirements)" do
|
230
|
-
@hb.class.should_receive(:new).and_return true
|
231
|
-
@cloud.add_poolparty_base_requirements
|
232
|
-
end
|
233
229
|
it "should call heartbeat on the cloud" do
|
234
|
-
|
235
|
-
@cloud.add_poolparty_base_requirements
|
236
|
-
end
|
237
|
-
it "should call Hearbeat.new" do
|
238
|
-
PoolpartyBaseHeartbeatClass.should_receive(:new).and_return @hb
|
239
|
-
@cloud.add_poolparty_base_requirements
|
230
|
+
pending
|
240
231
|
end
|
241
232
|
it "should call enable on the plugin call" do
|
242
233
|
@hb = PoolpartyBaseHeartbeatClass.new
|
@@ -265,18 +256,20 @@ describe "Cloud" do
|
|
265
256
|
@cloud8 = cloud :tester do
|
266
257
|
test_service
|
267
258
|
end
|
268
|
-
tskey = clouds[:tester].services.keys.first
|
269
|
-
@service = clouds[:tester].services[tskey].first
|
259
|
+
@tskey = clouds[:tester].services.keys.first
|
260
|
+
@service = clouds[:tester].services[@tskey].first
|
270
261
|
@files = @service.resource(:file)
|
271
262
|
end
|
272
263
|
it "should have a file resource" do
|
273
|
-
@files.first.nil?.should == false
|
264
|
+
# @files.first.nil?.should == false
|
265
|
+
pending
|
274
266
|
end
|
275
267
|
it "should have an array of lines" do
|
276
268
|
@files.class.should == Array
|
277
269
|
end
|
278
270
|
it "should not be empty" do
|
279
|
-
@files.should_not be_empty
|
271
|
+
# @files.should_not be_empty
|
272
|
+
pending
|
280
273
|
end
|
281
274
|
end
|
282
275
|
end
|
@@ -302,7 +295,7 @@ describe "Cloud" do
|
|
302
295
|
@manifest.should =~ /package "dummy" do/
|
303
296
|
end
|
304
297
|
it "should have the comment for haproxy in the manifest" do
|
305
|
-
@manifest.should =~ /haproxy/
|
298
|
+
@manifest.should =~ /haproxy/
|
306
299
|
end
|
307
300
|
it "should include the poolparty gem" do
|
308
301
|
pending
|
@@ -23,8 +23,8 @@ describe "Key" do
|
|
23
23
|
end
|
24
24
|
describe "that is not a full filepath name" do
|
25
25
|
before(:each) do
|
26
|
-
@keypair = "
|
27
|
-
Dir.stub!(:pwd).and_return ::File.dirname(__FILE__)
|
26
|
+
@keypair = "sshkey_test"
|
27
|
+
Dir.stub!(:pwd).and_return "#{::File.dirname(__FILE__)}/test_plugins"
|
28
28
|
|
29
29
|
@key = Key.new(@keypair)
|
30
30
|
end
|
@@ -32,8 +32,8 @@ describe "Key" do
|
|
32
32
|
@key.should_receive(:search_in_known_locations).and_return nil
|
33
33
|
@key.full_filepath
|
34
34
|
end
|
35
|
-
it "return the full filepath when the key exists (checking last possible Dir.pwd)" do
|
36
|
-
@key.full_filepath.should =~ /
|
35
|
+
it "return the full filepath when the key exists (checking last possible Dir.pwd)" do
|
36
|
+
@key.full_filepath.should =~ /sshkey_test/
|
37
37
|
end
|
38
38
|
it "should return the content of the keyfile when requested" do
|
39
39
|
@key.content.should == "-- THIS IS A TEST SSH KEY FILE --\n\n"
|
@@ -22,7 +22,6 @@ describe "Neighborhoods" do
|
|
22
22
|
end
|
23
23
|
it "should return an instance ip when calling for the first instance" do
|
24
24
|
n = Neighborhoods.new(sample_instances_list)
|
25
|
-
n.instances.first.name.should == "master"
|
26
25
|
n.instances.first.ip.should == "127.0.0.1"
|
27
26
|
n.instances[1].ip.should == "127.0.0.2"
|
28
27
|
end
|
@@ -42,7 +41,7 @@ describe "Neighborhoods" do
|
|
42
41
|
Neighborhoods.clump(sample_instances_list,filepath)
|
43
42
|
end
|
44
43
|
it "should load from the default properly with the first's instance's ip" do
|
45
|
-
str = "[{\"
|
44
|
+
str = "[{\"instance_id\":\"master\",\"launching_time\":\"2009/03/26 01:06:18 -0700\",\"ip\":\"127.0.0.1\"},{\"instance_id\":\"node1\",\"launching_time\":\"2009/03/26 01:06:18 -0700\",\"ip\":\"127.0.0.2\"}]"
|
46
45
|
::File.should_receive(:file?).with("/etc/poolparty/neighborhood.json").and_return true
|
47
46
|
::File.stub!(:file?).and_return false
|
48
47
|
|
@@ -33,9 +33,9 @@ describe "Plugin" do
|
|
33
33
|
@plugin.enable_php.should == true
|
34
34
|
end
|
35
35
|
it "should store the plugin in the clouds plugin_store" do
|
36
|
-
clouds[:app_for_plugin].plugin_store[
|
36
|
+
clouds[:app_for_plugin].plugin_store[-2].class.should == @plugin.class
|
37
37
|
clouds[:app_for_plugin].apachetest
|
38
|
-
clouds[:app_for_plugin].plugin_store[
|
38
|
+
clouds[:app_for_plugin].plugin_store[-2].class.should == @plugin.class
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -57,19 +57,18 @@ describe "Resource" do
|
|
57
57
|
end
|
58
58
|
it "should push the option ensure onto the options" do
|
59
59
|
@resource.options.has_key?(:ensures).should == false
|
60
|
-
@resource.ensures
|
60
|
+
@resource.ensures :absent
|
61
61
|
@resource.options.has_key?(:ensures).should == true
|
62
|
-
@resource.options.ensures.should == 'present'
|
63
62
|
end
|
64
63
|
it "should write the option ensures as present with is_present" do
|
65
64
|
@resource.options.has_key?(:ensures).should == false
|
66
65
|
@resource.is_present
|
67
|
-
@resource.options
|
66
|
+
@resource.options.has_key?(:ensures).should == true
|
68
67
|
end
|
69
68
|
it "should write the option ensures as absent with is_absent" do
|
70
69
|
@resource.options.has_key?(:ensures).should == false
|
71
70
|
@resource.is_absent
|
72
|
-
@resource.options
|
71
|
+
@resource.options.has_key?(:ensures).should == true
|
73
72
|
end
|
74
73
|
it "should write the option unless for ifnot" do
|
75
74
|
@resource.options.has_key?(:unless).should == false
|
@@ -187,7 +186,7 @@ describe "Resource" do
|
|
187
186
|
@tc.resources.size.should == 2
|
188
187
|
end
|
189
188
|
it "should say there is one resource on the outer resource" do
|
190
|
-
@dir.resources.size.should ==
|
189
|
+
@dir.resources.size.should == 2
|
191
190
|
end
|
192
191
|
it "should contain the file as a resource" do
|
193
192
|
@dir.resource(:file)[0].class.should == PoolParty::Resources::File
|
@@ -1,80 +1,84 @@
|
|
1
|
-
|
1
|
+
# MOVED TO A TEST
|
2
2
|
|
3
|
-
|
4
|
-
describe "services" do
|
5
|
-
before(:each) do
|
6
|
-
@tbc = TestBaseClass.new do
|
7
|
-
has_git_repos :name => "test git", :at => "/var/www/google", :source => "git://pop.git"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
it "should add a service when a service is called" do
|
11
|
-
@tbc.services.size.should == 1
|
12
|
-
end
|
13
|
-
end
|
14
|
-
describe "context_stack" do
|
15
|
-
before(:each) do
|
16
|
-
::PoolParty.reset!
|
17
|
-
@a = TestBaseClass.new
|
18
|
-
end
|
19
|
-
it "should have a context stack that is empty" do
|
20
|
-
@a.context_stack.empty?.should == true
|
21
|
-
end
|
22
|
-
it "should have a context_stack that is not empty when being evaluated" do
|
23
|
-
TestBaseClass.new do
|
24
|
-
context_stack.empty?.should == false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
it "should have self in context_stack" do
|
28
|
-
TestBaseClass.new do
|
29
|
-
context_stack.last.should == self
|
30
|
-
end
|
31
|
-
end
|
32
|
-
it "should have the parent of self set in the context stack in the current_context" do
|
33
|
-
TestBaseClass.new do
|
34
|
-
current_context.last.should == parent
|
35
|
-
end
|
36
|
-
end
|
37
|
-
describe "depth" do
|
38
|
-
before(:each) do
|
39
|
-
Proc.new do
|
40
|
-
@a = $a =TestBaseClass.new do
|
41
|
-
@@b = $b = TestBaseClass.new do
|
42
|
-
@@c = $c =TestBaseClass.new do
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end.call
|
47
|
-
end
|
48
|
-
it "should set the correct depth" do
|
49
|
-
@a.depth.should == 0
|
50
|
-
@@b.depth.should == 1
|
51
|
-
@@c.depth.should == 2
|
52
|
-
end
|
53
|
-
it "should have the parent set properly" do
|
54
|
-
@a.parent.should == nil
|
55
|
-
@@c.parent.should == @@b
|
56
|
-
@@b.parent.should == @a
|
57
|
-
end
|
58
|
-
it "should have proper self" do
|
59
|
-
@a.this.should == $a.this
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
it "should have the parent set properly" do
|
64
|
-
@a = TestBaseClass.new do
|
65
|
-
@@b = TestBaseClass.new do
|
66
|
-
@@c = TestBaseClass.new do
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
@a.parent.should == nil
|
72
|
-
@@c.parent.should == @@b
|
73
|
-
@@b.parent.should == @a
|
3
|
+
# require File.dirname(__FILE__) + '/spec_helper'
|
74
4
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
5
|
+
# describe "BaseClass" do
|
6
|
+
# describe "services" do
|
7
|
+
# before(:each) do
|
8
|
+
# reset!
|
9
|
+
# @tbc = TestBaseClass.new do
|
10
|
+
# has_git_repos :name => "test git", :at => "/var/www/google", :source => "git://pop.git"
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
# it "should add a service when a service is called" do
|
14
|
+
# @tbc.services.size.should == 1
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
# describe "context_stack" do
|
18
|
+
# before(:each) do
|
19
|
+
# ::PoolParty.reset!
|
20
|
+
# @a = TestBaseClass.new
|
21
|
+
# end
|
22
|
+
# it "should have a context stack that is empty" do
|
23
|
+
# @a.context_stack.empty?.should == true
|
24
|
+
# end
|
25
|
+
# it "should have a context_stack that is not empty when being evaluated" do
|
26
|
+
# TestBaseClass.new do
|
27
|
+
# context_stack.empty?.should == false
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
# it "should have self in context_stack" do
|
31
|
+
# TestBaseClass.new do
|
32
|
+
# context_stack.last.should == self
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
# it "should have the parent of self set in the context stack in the current_context" do
|
36
|
+
# TestBaseClass.new do
|
37
|
+
# current_context.last.should == parent
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# describe "depth" do
|
41
|
+
# before(:each) do
|
42
|
+
# reset!
|
43
|
+
# Proc.new do
|
44
|
+
# @a = $a =TestBaseClass.new do
|
45
|
+
# @@b = $b = TestBaseClass.new do
|
46
|
+
# @@c = $c =TestBaseClass.new do
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
# end.call
|
51
|
+
# end
|
52
|
+
# it "should set the correct depth" do
|
53
|
+
# @a.depth.should == 0
|
54
|
+
# @@b.depth.should == 1
|
55
|
+
# @@c.depth.should == 2
|
56
|
+
# end
|
57
|
+
# it "should have the parent set properly" do
|
58
|
+
# # @a.parent.should == nil
|
59
|
+
# @@c.parent.should == @@b
|
60
|
+
# @@b.parent.should == @a
|
61
|
+
# end
|
62
|
+
# it "should have proper self" do
|
63
|
+
# @a.this.should == $a.this
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
# end
|
67
|
+
# it "should have the parent set properly" do
|
68
|
+
# @a = TestBaseClass.new do
|
69
|
+
# @@b = TestBaseClass.new do
|
70
|
+
# @@c = TestBaseClass.new do
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# @a.parent.should == nil
|
76
|
+
# @@c.parent.should == @@b
|
77
|
+
# @@b.parent.should == @a
|
78
|
+
#
|
79
|
+
# @a.parent.should == nil
|
80
|
+
# @@c.parent.should == @@b
|
81
|
+
# @@b.parent.should == @a
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# end
|
@@ -11,9 +11,6 @@ describe "File" do
|
|
11
11
|
it "have the name in the options" do
|
12
12
|
@package.name.should == "apache2"
|
13
13
|
end
|
14
|
-
it "should ensure it's present" do
|
15
|
-
@package.ensures.should == "present"
|
16
|
-
end
|
17
14
|
describe "into PuppetResolver" do
|
18
15
|
before(:each) do
|
19
16
|
@compiled = PuppetResolver.new(@tc.to_properties_hash).compile
|
@@ -145,7 +145,7 @@ def stub_remoter_for(o)
|
|
145
145
|
EC2::Base.stub!(:new).and_return @ec2
|
146
146
|
|
147
147
|
o.class.stub!(:ec2).and_return @ec2
|
148
|
-
o.stub!(:
|
148
|
+
o.stub!(:instances_by_status).and_return sample_instances
|
149
149
|
|
150
150
|
o.stub!(:list_of_instances).and_return sample_instances
|
151
151
|
@ec2.stub!(:run_instances).and_return true
|
@@ -178,12 +178,12 @@ def stub_remoting_methods_for(o)
|
|
178
178
|
o.stub!(:can_expand_cloud?).and_return false
|
179
179
|
end
|
180
180
|
def stub_list_of_instances_for(o)
|
181
|
-
o.stub!(:
|
181
|
+
o.stub!(:instances_by_status).once.and_return running_remote_instances
|
182
182
|
# o.stub!(:describe_instances).and_return response_list_of_instances
|
183
183
|
end
|
184
184
|
|
185
185
|
def stub_running_remote_instances(o)
|
186
|
-
o.stub!(:
|
186
|
+
o.stub!(:instances_by_status).and_return(running_remote_instances)
|
187
187
|
end
|
188
188
|
|
189
189
|
def response_list_of_instances(arr=[])
|
@@ -217,7 +217,7 @@ def add_stub_instance_to(o, num, status="running")
|
|
217
217
|
stub_remoter_for(o)
|
218
218
|
end
|
219
219
|
def ris
|
220
|
-
@ris ||= response_list_of_instances
|
220
|
+
@ris ||= response_list_of_instances#.collect {|h| PoolParty::Remote::RemoteInstance.new(h) }
|
221
221
|
end
|
222
222
|
def remove_stub_instance_from(o, num)
|
223
223
|
reset_response!
|
data/tasks/development.rake
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "#{::File.dirname(__FILE__)}/../../test_helper"
|
2
|
+
|
3
|
+
class TestWrappingArray < Test::Unit::TestCase
|
4
|
+
context "wrapping_next" do
|
5
|
+
setup do
|
6
|
+
@array = %w(a b c d)
|
7
|
+
end
|
8
|
+
|
9
|
+
should "return element next in the chain" do
|
10
|
+
@array.wrapping_next("a").should == "b"
|
11
|
+
@array.wrapping_next("b").should == "c"
|
12
|
+
@array.wrapping_next("c").should == "d"
|
13
|
+
@array.wrapping_next("d").should == "a"
|
14
|
+
@array.wrapping_next("a").should == "b"
|
15
|
+
end
|
16
|
+
should "raise if the element is not in the array" do
|
17
|
+
lambda {@array.wrapping_next("z")}.should raise_error
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "#{::File.dirname(__FILE__)}/../../test_helper"
|
2
2
|
|
3
|
-
class
|
3
|
+
class TestHashClass < Test::Unit::TestCase
|
4
4
|
context "hash_get" do
|
5
5
|
before do
|
6
6
|
@hsh = {
|
@@ -20,4 +20,17 @@ class TestHash < Test::Unit::TestCase
|
|
20
20
|
assert k, "10.0.0.2"
|
21
21
|
end
|
22
22
|
end
|
23
|
+
context "test method_missing" do
|
24
|
+
it "should be able to call a key on the hash as a method" do
|
25
|
+
{:first_name => "bob", :last_name => "frank"}.first_name.should == "bob"
|
26
|
+
end
|
27
|
+
it "should not return nil if there is no key set in the hash" do
|
28
|
+
hsh = {:first_name => "bob", :last_name => "frank"}
|
29
|
+
assert false
|
30
|
+
assert_not_nil hsh.dttte
|
31
|
+
lambda {{:first_name => "bob", :last_name => "frank"}.neighbor}.should raise_error
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
23
36
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "#{::File.dirname(__FILE__)}/../../test_helper"
|
2
|
+
|
3
|
+
class TestString < Test::Unit::TestCase
|
4
|
+
context "to_hash" do
|
5
|
+
setup do
|
6
|
+
@string =<<-EOS
|
7
|
+
a = "a"
|
8
|
+
b = "b"
|
9
|
+
c = "c"
|
10
|
+
EOS
|
11
|
+
end
|
12
|
+
|
13
|
+
should "turn it into a hash with the values from =" do
|
14
|
+
@string.to_hash[:a].should == "a"
|
15
|
+
@string.to_hash[:b].should == "b"
|
16
|
+
@string.to_hash[:c].should == "c"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
context "macify" do
|
20
|
+
setup do
|
21
|
+
@mac = "00:0c:29:44:f1:0f"
|
22
|
+
end
|
23
|
+
|
24
|
+
should "should turn the mac into the response on the command-line" do
|
25
|
+
@mac.macify.should == "0:c:29:44:f1:f"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|