right_agent 0.6.6 → 0.9.3
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/lib/right_agent/agent.rb +26 -25
- data/lib/right_agent/agent_config.rb +28 -2
- data/lib/right_agent/command/command_constants.rb +2 -2
- data/lib/right_agent/core_payload_types/executable_bundle.rb +3 -21
- data/lib/right_agent/core_payload_types/login_user.rb +19 -4
- data/lib/right_agent/core_payload_types/recipe_instantiation.rb +7 -1
- data/lib/right_agent/core_payload_types/right_script_instantiation.rb +7 -1
- data/lib/right_agent/dispatcher.rb +6 -19
- data/lib/right_agent/idempotent_request.rb +72 -17
- data/lib/right_agent/monkey_patches/ruby_patch.rb +0 -1
- data/lib/right_agent/monkey_patches.rb +0 -1
- data/lib/right_agent/operation_result.rb +27 -4
- data/lib/right_agent/packets.rb +47 -23
- data/lib/right_agent/platform/darwin.rb +33 -2
- data/lib/right_agent/platform/linux.rb +98 -2
- data/lib/right_agent/platform/windows.rb +41 -6
- data/lib/right_agent/platform.rb +11 -2
- data/lib/right_agent/scripts/agent_controller.rb +2 -1
- data/lib/right_agent/scripts/agent_deployer.rb +2 -2
- data/lib/right_agent/scripts/stats_manager.rb +7 -3
- data/lib/right_agent/sender.rb +45 -28
- data/lib/right_agent.rb +2 -5
- data/right_agent.gemspec +5 -3
- data/spec/agent_config_spec.rb +1 -1
- data/spec/agent_spec.rb +26 -20
- data/spec/core_payload_types/login_user_spec.rb +7 -3
- data/spec/idempotent_request_spec.rb +218 -48
- data/spec/operation_result_spec.rb +19 -0
- data/spec/packets_spec.rb +42 -1
- data/spec/platform/darwin.rb +11 -0
- data/spec/platform/linux.rb +23 -0
- data/spec/platform/linux_volume_manager_spec.rb +43 -43
- data/spec/platform/platform_spec.rb +35 -32
- data/spec/platform/windows.rb +11 -0
- data/spec/sender_spec.rb +21 -25
- metadata +47 -40
- data/lib/right_agent/broker_client.rb +0 -686
- data/lib/right_agent/ha_broker_client.rb +0 -1327
- data/lib/right_agent/monkey_patches/amqp_patch.rb +0 -274
- data/lib/right_agent/monkey_patches/ruby_patch/string_patch.rb +0 -107
- data/lib/right_agent/stats_helper.rb +0 -745
- data/spec/broker_client_spec.rb +0 -962
- data/spec/ha_broker_client_spec.rb +0 -1695
- data/spec/monkey_patches/amqp_patch_spec.rb +0 -100
- data/spec/monkey_patches/string_patch_spec.rb +0 -99
- data/spec/stats_helper_spec.rb +0 -686
@@ -1,100 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2009-2011 RightScale Inc
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
24
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'right_agent', 'monkey_patches', 'amqp_patch'))
|
25
|
-
|
26
|
-
describe AMQP::Client do
|
27
|
-
context 'with an incorrect AMQP password' do
|
28
|
-
class SUT
|
29
|
-
include AMQP::Client
|
30
|
-
|
31
|
-
attr_accessor :reconnecting, :settings, :channels
|
32
|
-
end
|
33
|
-
|
34
|
-
before(:each) do
|
35
|
-
@sut = flexmock(SUT.new)
|
36
|
-
@sut.reconnecting = false
|
37
|
-
@sut.settings = {:host => 'testhost', :port=>'12345'}
|
38
|
-
@sut.channels = {}
|
39
|
-
|
40
|
-
@sut.should_receive(:initialize)
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'and no :reconnect_delay' do
|
44
|
-
it 'should reconnect immediately' do
|
45
|
-
flexmock(EM).should_receive(:reconnect).once
|
46
|
-
flexmock(EM).should_receive(:add_timer).never
|
47
|
-
|
48
|
-
@sut.reconnect()
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'and a :reconnect_delay of true' do
|
53
|
-
it 'should reconnect immediately' do
|
54
|
-
@sut.settings[:reconnect_delay] = true
|
55
|
-
|
56
|
-
flexmock(EM).should_receive(:reconnect).once
|
57
|
-
flexmock(EM).should_receive(:add_timer).never
|
58
|
-
|
59
|
-
@sut.reconnect()
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'and a :reconnect_delay of 15 seconds' do
|
64
|
-
it 'should schedule a reconnect attempt in 15s' do
|
65
|
-
@sut.settings[:reconnect_delay] = 15
|
66
|
-
|
67
|
-
flexmock(EM).should_receive(:reconnect).never
|
68
|
-
flexmock(EM).should_receive(:add_timer).with(15, Proc).once
|
69
|
-
|
70
|
-
@sut.reconnect()
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'and a :reconnect_delay containing a Proc that returns 30' do
|
75
|
-
it 'should schedule a reconnect attempt in 30s' do
|
76
|
-
@sut.settings[:reconnect_delay] = Proc.new {30}
|
77
|
-
|
78
|
-
flexmock(EM).should_receive(:reconnect).never
|
79
|
-
flexmock(EM).should_receive(:add_timer).with(30, Proc).once
|
80
|
-
|
81
|
-
@sut.reconnect()
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'and a :reconnect_interval of 5 seconds' do
|
86
|
-
it 'should schedule reconnect attempts on a 5s interval' do
|
87
|
-
@sut.reconnecting = true
|
88
|
-
@sut.settings[:reconnect_delay] = 15
|
89
|
-
@sut.settings[:reconnect_interval] = 5
|
90
|
-
|
91
|
-
flexmock(EM).should_receive(:reconnect).never
|
92
|
-
flexmock(EM).should_receive(:add_timer).with(5, Proc).once
|
93
|
-
|
94
|
-
@sut.reconnect()
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2009-2011 RightScale Inc
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
24
|
-
|
25
|
-
describe String do
|
26
|
-
|
27
|
-
describe ".snake_case" do
|
28
|
-
|
29
|
-
it "should downcase single word" do
|
30
|
-
["FOO", "Foo", "foo"].each do |w|
|
31
|
-
w.snake_case.should == "foo"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should not separate numbers from end of word" do
|
36
|
-
["Foo1234", "foo1234"].each do |w|
|
37
|
-
w.snake_case.should == "foo1234"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should not separate numbers from word that starts with uppercase letter" do
|
42
|
-
"1234Foo".snake_case.should == "1234foo"
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should not separate numbers from word that starts with lowercase letter" do
|
46
|
-
"1234foo".snake_case.should == "1234foo"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should downcase camel-cased words and connect with underscore" do
|
50
|
-
["FooBar", "fooBar"].each do |w|
|
51
|
-
w.snake_case.should == "foo_bar"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should start new word with uppercase letter before lower case letter" do
|
56
|
-
["FooBARBaz", "fooBARBaz"].each do |w|
|
57
|
-
w.snake_case.should == "foo_bar_baz"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
describe ".to_const_path" do
|
64
|
-
|
65
|
-
it "should snake-case the string" do
|
66
|
-
"Hello::World".to_const_path.should == "hello/world"
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should leave (snake-cased) string without '::' unchanged" do
|
70
|
-
"hello".to_const_path.should == "hello"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should replace single '::' with '/'" do
|
74
|
-
"hello::world".to_const_path.should == "hello/world"
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should replace multiple '::' with '/'" do
|
78
|
-
"hello::rightscale::world".to_const_path.should == "hello/rightscale/world"
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
describe '.camelize' do
|
84
|
-
|
85
|
-
it 'should camelize the string' do
|
86
|
-
'hello/world_hello'.camelize.should == 'Hello::WorldHello'
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'should camelize strings with integers' do
|
90
|
-
'1hel2lo3/4wor5ld6_7hel8lo9'.camelize.should == '1hel2lo3::4wor5ld67hel8lo9'
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'should leave camelized strings alone' do
|
94
|
-
'1Hel2lo3::4Wor5ld67Hel8lo9'.camelize.should == '1Hel2lo3::4Wor5ld67Hel8lo9'
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
end # String
|