auser-poolparty 0.2.16 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +72 -7
- data/PostInstall.txt +1 -1
- data/Rakefile +11 -0
- data/bin/cloud-provision +6 -10
- data/bin/server-build-messenger +20 -0
- data/bin/server-fire-cmd +0 -2
- data/bin/server-list-responding +24 -0
- data/bin/server-start-master +4 -9
- data/bin/server-start-node +7 -6
- data/lib/erlang/messenger/Emakefile +1 -0
- data/lib/erlang/messenger/Rakefile +29 -20
- 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/packager.app +19 -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_rel-0.1.rel +1 -7
- 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_rel-0.1.rel +1 -7
- 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/AUTHORS +2 -0
- data/lib/erlang/messenger/lib/eunit/CHANGELOG +14 -0
- data/lib/erlang/messenger/lib/eunit/COPYING +504 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
- data/lib/erlang/messenger/lib/eunit/NOTES +276 -0
- data/lib/erlang/messenger/lib/eunit/README +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/edoc-info +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/erlang.png +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/eunit.html +172 -0
- data/lib/erlang/messenger/lib/eunit/doc/index.html +17 -0
- data/lib/erlang/messenger/lib/eunit/doc/modules-frame.html +12 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview-summary.html +984 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview.edoc +980 -0
- data/lib/erlang/messenger/lib/eunit/doc/packages-frame.html +11 -0
- data/lib/erlang/messenger/lib/eunit/doc/stylesheet.css +55 -0
- 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 +21 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.appup +1 -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/examples/eunit_examples.erl +339 -0
- data/lib/erlang/messenger/lib/eunit/examples/fib.erl +19 -0
- data/lib/erlang/messenger/lib/eunit/examples/tests.txt +1 -0
- data/lib/erlang/messenger/lib/eunit/include/eunit.hrl +313 -0
- data/lib/erlang/messenger/lib/eunit/src/Makefile +46 -0
- data/lib/erlang/messenger/lib/eunit/src/autoload.erl +388 -0
- data/lib/erlang/messenger/lib/eunit/src/code_monitor.erl +243 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.app.src +21 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.appup.src +1 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.erl +196 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_autoexport.erl +102 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_data.erl +798 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_internal.hrl +48 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_lib.erl +682 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_proc.erl +552 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_serial.erl +157 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_server.erl +340 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_striptests.erl +64 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_test.erl +334 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tests.erl +45 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tty.erl +272 -0
- data/lib/erlang/messenger/lib/eunit/src/file_monitor.erl +409 -0
- data/lib/erlang/messenger/lib/eunit/sys.config +9 -0
- data/lib/erlang/messenger/lib/eunit/vsn.mk +1 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +75 -2
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +75 -2
- data/lib/erlang/messenger/src/pm_client.erl +8 -3
- data/lib/erlang/messenger/src/pm_cluster.erl +32 -9
- data/lib/erlang/messenger/src/pm_master.erl +10 -11
- data/lib/erlang/messenger/src/pm_node.erl +2 -3
- data/lib/erlang/messenger/src/pm_packager.erl +73 -0
- data/lib/erlang/messenger/src/utils.erl +3 -10
- data/lib/poolparty/base_packages/heartbeat.rb +9 -9
- data/lib/poolparty/base_packages/poolparty.rb +16 -10
- data/lib/poolparty/config/allowed_commands.yml +1 -0
- data/lib/poolparty/core/object.rb +8 -0
- data/lib/poolparty/exceptions/UnacceptableCommand.rb +5 -0
- data/lib/poolparty/helpers/messenger.rb +29 -0
- data/lib/poolparty/helpers/provisioner_base.rb +7 -7
- data/lib/poolparty/helpers/provisioners/master.rb +3 -7
- data/lib/poolparty/helpers/provisioners/slave.rb +1 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +7 -5
- data/lib/poolparty/modules/configurable.rb +1 -1
- data/lib/poolparty/modules/method_missing_sugar.rb +6 -1
- data/lib/poolparty/modules/pretty_printer.rb +1 -0
- data/lib/poolparty/modules/resourcing_dsl.rb +2 -1
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +1 -1
- data/lib/poolparty/net/remoter.rb +3 -1
- data/lib/poolparty/plugins/git.rb +3 -3
- data/lib/poolparty/pool/base.rb +7 -2
- data/lib/poolparty/pool/cloud.rb +3 -3
- data/lib/poolparty/pool/resource.rb +38 -24
- data/lib/poolparty/pool/resources/class_package.rb +2 -2
- data/lib/poolparty/pool/resources/conditional.rb +8 -4
- data/lib/poolparty/pool/resources/{gem.rb → gem_package.rb} +0 -0
- data/lib/poolparty/pool/resources/package.rb +8 -1
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +1 -1
- data/poolparty.gemspec +476 -61
- data/spec/poolparty/core/object_spec.rb +20 -0
- data/spec/poolparty/helpers/messenger_spec.rb +14 -0
- data/spec/poolparty/helpers/provisioners/master_spec.rb +2 -2
- data/spec/poolparty/net/remoter_spec.rb +1 -1
- data/spec/poolparty/plugins/git_spec.rb +26 -19
- data/spec/poolparty/pool/base_spec.rb +20 -2
- data/spec/poolparty/pool/cloud_spec.rb +256 -249
- data/spec/poolparty/pool/custom_resource_spec.rb +6 -1
- data/spec/poolparty/pool/plugin_spec.rb +71 -65
- data/spec/poolparty/pool/resource_spec.rb +314 -237
- data/spec/poolparty/pool/resources/class_package_spec.rb +71 -66
- data/spec/poolparty/pool/resources/conditional_spec.rb +30 -26
- data/spec/poolparty/pool/resources/gem_spec.rb +18 -14
- data/spec/poolparty/pool/resources/variable_spec.rb +1 -1
- data/spec/poolparty/pool/script_spec.rb +46 -37
- data/spec/poolparty/spec_helper.rb +4 -0
- data/tasks/cloud.rake +0 -54
- data/tasks/development.rake +11 -14
- data/tasks/ec2.rake +10 -17
- data/tasks/instance.rake +0 -61
- data/website/index.html +1 -1
- metadata +83 -10
@@ -1,6 +1,8 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
include PoolParty::Cloud
|
4
|
+
include PoolParty::Resources
|
5
|
+
|
4
6
|
class TestServiceClass
|
5
7
|
plugin :test_service do
|
6
8
|
def enable
|
@@ -11,317 +13,322 @@ end
|
|
11
13
|
|
12
14
|
describe "Cloud" do
|
13
15
|
before(:each) do
|
14
|
-
|
15
|
-
@pool = pool :just_pool do; end
|
16
|
-
end
|
17
|
-
it "should respond to the pool method outside the block" do
|
18
|
-
@obj.respond_to?(:cloud).should == true
|
16
|
+
reset_resources!
|
19
17
|
end
|
20
|
-
describe "
|
18
|
+
describe "wrapped" do
|
21
19
|
before(:each) do
|
22
|
-
@
|
23
|
-
|
24
|
-
it "should store the cloud in the global list of clouds" do
|
25
|
-
@obj.clouds.has_key?(:pop).should == true
|
26
|
-
end
|
27
|
-
it "should store the cloud" do
|
28
|
-
@obj.cloud(:pop).should == @cloud1
|
20
|
+
@obj = Object.new
|
21
|
+
@pool = pool :just_pool do; end
|
29
22
|
end
|
30
|
-
it "should
|
31
|
-
@
|
23
|
+
it "should respond to the pool method outside the block" do
|
24
|
+
@obj.respond_to?(:cloud).should == true
|
32
25
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
it "should return the cloud if the cloud key is already in the clouds list" do
|
38
|
-
@cld = cloud :pop do;end
|
39
|
-
@pool.cloud(:pop).should == @cld
|
40
|
-
end
|
41
|
-
describe "options" do
|
42
|
-
before(:each) do
|
43
|
-
reset!
|
44
|
-
@p = pool :options do
|
45
|
-
minimum_instances 100
|
46
|
-
access_key "access_key"
|
47
|
-
cloud :apple do
|
48
|
-
access_key "cloud_access_key"
|
49
|
-
end
|
26
|
+
describe "global" do
|
27
|
+
before(:each) do
|
28
|
+
@cloud1 = cloud :pop do;end
|
50
29
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
describe "block" do
|
64
|
-
before(:each) do
|
65
|
-
reset!
|
66
|
-
@cloud = Cloud.new(:test, @pool) do
|
67
|
-
# Inside cloud block
|
68
|
-
keypair "fake_keypair"
|
30
|
+
it "should store the cloud in the global list of clouds" do
|
31
|
+
@obj.clouds.has_key?(:pop).should == true
|
32
|
+
end
|
33
|
+
it "should store the cloud" do
|
34
|
+
@obj.cloud(:pop).should == @cloud1
|
35
|
+
end
|
36
|
+
it "should have set the using base on intantiation to ec2" do
|
37
|
+
@cloud1.using_remoter?.should_not == nil
|
38
|
+
end
|
39
|
+
it "should say the remoter_base is ec2 (by default)" do
|
40
|
+
@cloud1.remote_base.should == PoolParty::Ec2
|
69
41
|
end
|
70
42
|
end
|
71
|
-
|
72
|
-
|
73
|
-
@cloud.
|
74
|
-
end
|
75
|
-
it "should have services in an array" do
|
76
|
-
@cloud.services.class.should == Array
|
77
|
-
end
|
78
|
-
it "should have no services in the array when there are no services defined" do
|
79
|
-
@cloud.services.size.should == 0
|
80
|
-
end
|
81
|
-
it "should respond to a configure method" do
|
82
|
-
@cloud.respond_to?(:configure).should == true
|
43
|
+
it "should return the cloud if the cloud key is already in the clouds list" do
|
44
|
+
@cld = cloud :pop do;end
|
45
|
+
@pool.cloud(:pop).should == @cld
|
83
46
|
end
|
84
|
-
describe "
|
47
|
+
describe "options" do
|
85
48
|
before(:each) do
|
86
49
|
reset!
|
87
|
-
@
|
88
|
-
minimum_instances
|
89
|
-
|
50
|
+
@p = pool :options do
|
51
|
+
minimum_instances 100
|
52
|
+
access_key "access_key"
|
53
|
+
cloud :apple do
|
54
|
+
access_key "cloud_access_key"
|
55
|
+
end
|
90
56
|
end
|
57
|
+
@c = @p.cloud(:apple)
|
91
58
|
end
|
92
|
-
it "should be able to
|
93
|
-
@
|
59
|
+
it "should be able to grab the cloud from the pool" do
|
60
|
+
@c.should == @p.cloud(:apple)
|
94
61
|
end
|
95
|
-
it "should
|
96
|
-
@
|
62
|
+
it "should take the options set on the pool" do
|
63
|
+
@p.minimum_instances.should == 100
|
64
|
+
end
|
65
|
+
it "should take the access_key option set from the cloud" do
|
66
|
+
@c.access_key.should == "cloud_access_key"
|
97
67
|
end
|
98
68
|
end
|
99
|
-
describe "
|
100
|
-
|
101
|
-
|
69
|
+
describe "block" do
|
70
|
+
before(:each) do
|
71
|
+
reset!
|
72
|
+
@cloud = Cloud.new(:test, @pool) do
|
73
|
+
# Inside cloud block
|
74
|
+
keypair "fake_keypair"
|
75
|
+
end
|
102
76
|
end
|
103
|
-
|
104
|
-
|
77
|
+
|
78
|
+
it "should be able to pull the pool from the cloud" do
|
79
|
+
@cloud.parent == @pool
|
80
|
+
end
|
81
|
+
it "should have services in an array" do
|
82
|
+
@cloud.services.class.should == Array
|
105
83
|
end
|
106
|
-
it "should
|
107
|
-
@cloud.
|
108
|
-
@cloud.minimum_instances.should == 3
|
84
|
+
it "should have no services in the array when there are no services defined" do
|
85
|
+
@cloud.services.size.should == 0
|
109
86
|
end
|
110
|
-
it "should
|
111
|
-
@cloud.
|
112
|
-
@cloud.keypair.should == "friend"
|
87
|
+
it "should respond to a configure method" do
|
88
|
+
@cloud.respond_to?(:configure).should == true
|
113
89
|
end
|
114
|
-
describe "
|
90
|
+
describe "configuration" do
|
115
91
|
before(:each) do
|
116
92
|
reset!
|
117
|
-
@
|
118
|
-
|
119
|
-
|
120
|
-
end
|
93
|
+
@cloud2 = Cloud.new(:test, @pool) do
|
94
|
+
minimum_instances 1
|
95
|
+
maximum_instances 2
|
121
96
|
end
|
122
|
-
@cloud = @pool.cloud(:app)
|
123
97
|
end
|
124
|
-
it "should
|
125
|
-
@
|
98
|
+
it "should be able to se the minimum_instances without the var" do
|
99
|
+
@cloud2.minimum_instances.should == 1
|
126
100
|
end
|
127
|
-
it "should
|
128
|
-
@
|
101
|
+
it "should be able to se the maximum_instances with the =" do
|
102
|
+
@cloud2.maximum_instances.should == 2
|
129
103
|
end
|
130
104
|
end
|
131
|
-
describe "
|
132
|
-
|
133
|
-
|
105
|
+
describe "options" do
|
106
|
+
it "should set the minimum_instances to 2" do
|
107
|
+
@cloud.minimum_instances.should == 2
|
134
108
|
end
|
135
|
-
it "should
|
136
|
-
@
|
137
|
-
keypair "hotdog"
|
138
|
-
end
|
139
|
-
@c.keypair.should == "hotdog"
|
109
|
+
it "should set the maximum_instances to 4" do
|
110
|
+
@cloud.maximum_instances.should == 4
|
140
111
|
end
|
141
|
-
it "should
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
112
|
+
it "should be able to set the minimum instances" do
|
113
|
+
@cloud.minimum_instances 3
|
114
|
+
@cloud.minimum_instances.should == 3
|
115
|
+
end
|
116
|
+
it "should be able to take a hash from configure and convert it to the options" do
|
117
|
+
@cloud.configure( {:minimum_instances => 1, :maximum_instances => 10, :keypair => "friend"} )
|
118
|
+
@cloud.keypair.should == "friend"
|
119
|
+
end
|
120
|
+
describe "minimum_instances/maximum_instances as a range" do
|
121
|
+
before(:each) do
|
122
|
+
reset!
|
123
|
+
@pool = pool :just_pool do
|
124
|
+
cloud :app do
|
125
|
+
instances 8..15
|
126
|
+
end
|
147
127
|
end
|
128
|
+
@cloud = @pool.cloud(:app)
|
129
|
+
end
|
130
|
+
it "should set the minimum based on the range" do
|
131
|
+
@cloud.minimum_instances.should == 8
|
132
|
+
end
|
133
|
+
it "should set the maximum based on the range set by instances" do
|
134
|
+
@cloud.maximum_instances.should == 15
|
148
135
|
end
|
149
|
-
pool(:pool).cloud(:app).keypair.should == "ney"
|
150
|
-
pool(:pool).cloud(:group).keypair.should == "ney"
|
151
136
|
end
|
152
|
-
|
153
|
-
|
154
|
-
|
137
|
+
describe "keypair" do
|
138
|
+
before(:each) do
|
139
|
+
reset!
|
140
|
+
end
|
141
|
+
it "should be able to define a keypair in the cloud" do
|
142
|
+
@c = cloud :app do
|
143
|
+
keypair "hotdog"
|
155
144
|
end
|
156
|
-
|
145
|
+
@c.keypair.should == "hotdog"
|
146
|
+
end
|
147
|
+
it "should take the pool parent's keypair if it's defined on the pool" do
|
148
|
+
pool :pool do
|
149
|
+
keypair "ney"
|
150
|
+
cloud :app do
|
151
|
+
end
|
152
|
+
cloud :group do
|
153
|
+
end
|
157
154
|
end
|
155
|
+
pool(:pool).cloud(:app).keypair.should == "ney"
|
156
|
+
pool(:pool).cloud(:group).keypair.should == "ney"
|
158
157
|
end
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
reset!
|
166
|
-
stub_list_from_remote_for(@cloud)
|
167
|
-
@cloud.instance_eval do
|
168
|
-
has_file(:name => "/etc/httpd/http.conf") do
|
169
|
-
content <<-EOE
|
170
|
-
hello my lady
|
171
|
-
EOE
|
158
|
+
it "should generate a keypair based on the cloud name if none is defined" do
|
159
|
+
pool :pool do
|
160
|
+
cloud :app do
|
161
|
+
end
|
162
|
+
cloud :nickes do
|
163
|
+
end
|
172
164
|
end
|
173
|
-
|
174
|
-
|
165
|
+
pool(:pool).cloud(:app).keypair.should == "pool_app"
|
166
|
+
pool(:pool).cloud(:nickes).keypair.should == "pool_nickes"
|
175
167
|
end
|
176
168
|
end
|
177
|
-
|
178
|
-
@cloud.respond_to?(:build_manifest).should == true
|
179
|
-
end
|
180
|
-
it "should have 3 resources" do
|
181
|
-
@cloud.add_poolparty_base_requirements
|
182
|
-
@cloud.number_of_resources.should > 3
|
183
|
-
end
|
184
|
-
it "should receive add_poolparty_base_requirements before building the manifest" do
|
185
|
-
@cloud.should_receive(:add_poolparty_base_requirements).once
|
186
|
-
@cloud.build_manifest
|
187
|
-
end
|
188
|
-
describe "add_poolparty_base_requirements" do
|
169
|
+
describe "Manifest" do
|
189
170
|
before(:each) do
|
190
|
-
reset!
|
171
|
+
reset!
|
172
|
+
stub_list_from_remote_for(@cloud)
|
191
173
|
@cloud.instance_eval do
|
192
|
-
|
174
|
+
has_file(:name => "/etc/httpd/http.conf") do
|
175
|
+
content <<-EOE
|
176
|
+
hello my lady
|
177
|
+
EOE
|
178
|
+
end
|
179
|
+
has_gempackage(:name => "poolparty")
|
180
|
+
has_package(:name => "dummy")
|
193
181
|
end
|
194
|
-
@hb = "heartbeat".class_constant.new(@cloud)
|
195
182
|
end
|
196
|
-
it "should
|
197
|
-
@
|
198
|
-
@cloud.add_poolparty_base_requirements
|
183
|
+
it "should it should have the method build_manifest" do
|
184
|
+
@cloud.respond_to?(:build_manifest).should == true
|
199
185
|
end
|
200
|
-
it "should
|
201
|
-
@cloud.should_receive(:heartbeat).and_return true
|
186
|
+
it "should have 3 resources" do
|
202
187
|
@cloud.add_poolparty_base_requirements
|
188
|
+
@cloud.number_of_resources.should > 2
|
203
189
|
end
|
204
|
-
it "should
|
205
|
-
|
206
|
-
@cloud.
|
207
|
-
end
|
208
|
-
it "should call enable on the plugin call" do
|
209
|
-
@hb = "heartbeat".class_constant
|
210
|
-
"heartbeat".class_constant.stub!(:new).and_return @hb
|
211
|
-
|
212
|
-
@cloud.add_poolparty_base_requirements
|
213
|
-
@cloud.heartbeat.should == @hb
|
190
|
+
it "should receive add_poolparty_base_requirements before building the manifest" do
|
191
|
+
@cloud.should_receive(:add_poolparty_base_requirements).once
|
192
|
+
@cloud.build_manifest
|
214
193
|
end
|
215
|
-
describe "
|
194
|
+
describe "add_poolparty_base_requirements" do
|
216
195
|
before(:each) do
|
217
|
-
|
218
|
-
@cloud.
|
196
|
+
reset!
|
197
|
+
@cloud.instance_eval do
|
198
|
+
@heartbeat = nil
|
199
|
+
end
|
200
|
+
@hb = "heartbeat".class_constant.new(@cloud)
|
201
|
+
end
|
202
|
+
it "should call initialize on heartbeat (in add_poolparty_base_requirements)" do
|
203
|
+
@hb.class.should_receive(:new).and_return true
|
204
|
+
@cloud.add_poolparty_base_requirements
|
219
205
|
end
|
220
|
-
it "should
|
221
|
-
@cloud.
|
206
|
+
it "should call heartbeat on the cloud" do
|
207
|
+
@cloud.should_receive(:heartbeat).and_return true
|
208
|
+
@cloud.add_poolparty_base_requirements
|
222
209
|
end
|
223
|
-
it "should
|
224
|
-
|
210
|
+
it "should call Hearbeat.new" do
|
211
|
+
"heartbeat".class_constant.should_receive(:new).and_return @hb
|
212
|
+
@cloud.add_poolparty_base_requirements
|
225
213
|
end
|
226
|
-
it "should
|
227
|
-
@
|
214
|
+
it "should call enable on the plugin call" do
|
215
|
+
@hb = "heartbeat".class_constant
|
216
|
+
"heartbeat".class_constant.stub!(:new).and_return @hb
|
217
|
+
|
218
|
+
@cloud.add_poolparty_base_requirements
|
219
|
+
@cloud.heartbeat.should == @hb
|
228
220
|
end
|
229
|
-
describe "
|
221
|
+
describe "after adding" do
|
230
222
|
before(:each) do
|
231
|
-
|
232
|
-
|
233
|
-
end
|
234
|
-
@service = @cloud8.services.first
|
235
|
-
@files = @service.resource(:file)
|
223
|
+
stub_list_from_remote_for(@cloud)
|
224
|
+
@cloud.add_poolparty_base_requirements
|
236
225
|
end
|
237
|
-
it "should
|
238
|
-
@
|
226
|
+
it "should add resources onto the heartbeat class inside the cloud" do
|
227
|
+
@cloud.services.size.should > 0
|
239
228
|
end
|
240
|
-
it "should
|
241
|
-
@
|
229
|
+
it "should store the class heartbeat" do
|
230
|
+
@cloud.services.map {|a| a.class}.include?("heartbeat".class_constant).should == true
|
242
231
|
end
|
243
|
-
it "should
|
244
|
-
@
|
232
|
+
it "should have an array of resources on the heartbeat" do
|
233
|
+
@cloud.services.first.resources.class.should == Hash
|
234
|
+
end
|
235
|
+
describe "resources" do
|
236
|
+
before(:each) do
|
237
|
+
@cloud8 = Cloud.new(:tester, @pool) do
|
238
|
+
test_service
|
239
|
+
end
|
240
|
+
@service = @cloud8.services.first
|
241
|
+
@files = @service.resource(:file)
|
242
|
+
end
|
243
|
+
it "should have a file resource" do
|
244
|
+
@files.first.nil?.should == false
|
245
|
+
end
|
246
|
+
it "should have an array of lines" do
|
247
|
+
@files.class.should == Array
|
248
|
+
end
|
249
|
+
it "should not be empty" do
|
250
|
+
@files.should_not be_empty
|
251
|
+
end
|
245
252
|
end
|
246
253
|
end
|
247
254
|
end
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
end
|
281
|
-
end
|
282
|
-
describe "building with an existing manifest" do
|
283
|
-
before(:each) do
|
284
|
-
@file = "/etc/puppet/manifests/nodes/nodes.pp"
|
285
|
-
@file.stub!(:read).and_return "nodes"
|
286
|
-
::FileTest.stub!(:file?).with("/etc/puppet/manifests/classes/poolparty.pp").and_return true
|
287
|
-
@cloud.stub!(:open).with("/etc/puppet/manifests/classes/poolparty.pp").and_return @file
|
288
|
-
end
|
289
|
-
it "should not call resources_string_from_resources if the file /etc/puppet/manifests/nodes/nodes.pp exists" do
|
290
|
-
@cloud.should_not_receive(:add_poolparty_base_requirements)
|
291
|
-
@cloud.build_manifest
|
255
|
+
describe "building" do
|
256
|
+
before(:each) do
|
257
|
+
str = "master 192.168.0.1
|
258
|
+
node1 192.168.0.2"
|
259
|
+
@sample_instances_list = [{:ip => "192.168.0.1", :name => "master"}, {:ip => "192.168.0.2", :name => "node1"}]
|
260
|
+
@ris = @sample_instances_list.map {|h| PoolParty::Remote::RemoteInstance.new(h, @cloud) }
|
261
|
+
|
262
|
+
@manifest = @cloud.build_manifest
|
263
|
+
end
|
264
|
+
it "should return a string when calling build_manifest" do
|
265
|
+
@manifest.class.should == String
|
266
|
+
end
|
267
|
+
it "should have a comment of # file in the manifest as described by the has_file" do
|
268
|
+
@manifest.should =~ /file \{/
|
269
|
+
end
|
270
|
+
it "should have the comment of a package in the manifest" do
|
271
|
+
@manifest.should =~ /package \{/
|
272
|
+
end
|
273
|
+
it "should have the comment for heartbeat in the manifest" do
|
274
|
+
@manifest.should =~ /class heartbeat/
|
275
|
+
end
|
276
|
+
it "should include the poolparty gem" do
|
277
|
+
@manifest.should =~ /package \{/
|
278
|
+
end
|
279
|
+
it "should include custom functions" do
|
280
|
+
@manifest.should =~ /define line\(\$file/
|
281
|
+
|
282
|
+
File.open("test_manifest.pp", "w+") {|f| f << @manifest}
|
283
|
+
end
|
284
|
+
it "should include the hosts for all the listed local instances" do
|
285
|
+
@manifest.should =~ /host \{\n\t\t"master":/
|
286
|
+
end
|
292
287
|
end
|
293
|
-
|
294
|
-
|
288
|
+
describe "building with an existing manifest" do
|
289
|
+
before(:each) do
|
290
|
+
@file = "/etc/puppet/manifests/nodes/nodes.pp"
|
291
|
+
@file.stub!(:read).and_return "nodes"
|
292
|
+
::FileTest.stub!(:file?).with("/etc/puppet/manifests/classes/poolparty.pp").and_return true
|
293
|
+
@cloud.stub!(:open).with("/etc/puppet/manifests/classes/poolparty.pp").and_return @file
|
294
|
+
end
|
295
|
+
it "should not call resources_string_from_resources if the file /etc/puppet/manifests/nodes/nodes.pp exists" do
|
296
|
+
@cloud.should_not_receive(:add_poolparty_base_requirements)
|
297
|
+
@cloud.build_manifest
|
298
|
+
end
|
299
|
+
it "should build from the existing file" do
|
300
|
+
@cloud.build_manifest.should == "nodes"
|
301
|
+
end
|
295
302
|
end
|
296
303
|
end
|
297
304
|
end
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
describe "provisioning" do
|
314
|
-
it "should be able to tell that it is provisioning when setting the provisioning flag" do
|
315
|
-
@cloud.provisioning?.should == false
|
316
|
-
end
|
317
|
-
it "should be able to set it as provisioning" do
|
318
|
-
@cloud.provisioning_in_progress
|
319
|
-
@cloud.provisioning?.should == true
|
305
|
+
|
306
|
+
describe "instances" do
|
307
|
+
before(:each) do
|
308
|
+
@cloud3 = cloud :pop do;keypair "fake_keypair";end
|
309
|
+
stub_list_from_remote_for(@cloud3)
|
310
|
+
end
|
311
|
+
it "should respond to the method master" do
|
312
|
+
@cloud3.respond_to?(:master).should == true
|
313
|
+
end
|
314
|
+
it "should return a master that is not nil" do
|
315
|
+
@cloud3.master.should_not be_nil
|
316
|
+
end
|
320
317
|
end
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
318
|
+
|
319
|
+
describe "provisioning" do
|
320
|
+
it "should be able to tell that it is provisioning when setting the provisioning flag" do
|
321
|
+
@cloud.provisioning?.should == false
|
322
|
+
end
|
323
|
+
it "should be able to set it as provisioning" do
|
324
|
+
@cloud.provisioning_in_progress
|
325
|
+
@cloud.provisioning?.should == true
|
326
|
+
end
|
327
|
+
it "should be able to unset itself as provisioning" do
|
328
|
+
@cloud.provisioning_in_progress
|
329
|
+
@cloud.provisioning_complete
|
330
|
+
@cloud.provisioning?.should == false
|
331
|
+
end
|
325
332
|
end
|
326
333
|
end
|
327
334
|
end
|
@@ -75,11 +75,16 @@ describe "Custom Resource" do
|
|
75
75
|
resource(:rockstar).class.should == Array
|
76
76
|
end
|
77
77
|
describe "call function" do
|
78
|
+
before(:each) do
|
79
|
+
@res = Class.new
|
80
|
+
@res.stub!(:class_name_sym).and_return :bunk
|
81
|
+
@res.stub!(:key).and_return "bunk"
|
82
|
+
end
|
78
83
|
it "should have the class CallFunction available" do
|
79
84
|
lambda {PoolParty::Resources::CallFunction}.should_not raise_error
|
80
85
|
end
|
81
86
|
it "should create a new CallFunction instance when calling call_function with a string" do
|
82
|
-
PoolParty::Resources::CallFunction.should_receive(:new).and_return
|
87
|
+
PoolParty::Resources::CallFunction.should_receive(:new).and_return @res
|
83
88
|
add_resource(:call_function, :name => "line")
|
84
89
|
end
|
85
90
|
it "should create a call function in the function call array" do
|