right_agent 0.6.3 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/right_agent.rb +1 -0
- data/lib/right_agent/agent_tags_manager.rb +1 -1
- data/lib/right_agent/broker_client.rb +6 -1
- data/lib/right_agent/core_payload_types.rb +1 -0
- data/lib/right_agent/core_payload_types/dev_repositories.rb +11 -1
- data/lib/right_agent/core_payload_types/dev_repository.rb +76 -0
- data/lib/right_agent/log.rb +2 -1
- data/lib/right_agent/monkey_patches/amqp_patch.rb +181 -102
- data/lib/right_agent/platform/linux.rb +134 -2
- data/lib/right_agent/sender.rb +7 -3
- data/right_agent.gemspec +2 -2
- data/spec/broker_client_spec.rb +37 -37
- data/spec/core_payload_types/dev_repositories_spec.rb +5 -5
- data/spec/core_payload_types/dev_repository_spec.rb +33 -0
- data/spec/monkey_patches/amqp_patch_spec.rb +0 -12
- data/spec/platform/linux_volume_manager_spec.rb +180 -0
- data/spec/sender_spec.rb +95 -0
- metadata +39 -36
@@ -27,8 +27,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'r
|
|
27
27
|
module RightScale
|
28
28
|
describe DevRepositories do
|
29
29
|
before(:each) do
|
30
|
-
@expected_repo1 = {"111" =>
|
31
|
-
@expected_repo2 = {"222" =>
|
30
|
+
@expected_repo1 = { "111" => DevRepository.new(:git, "bunk", nil, nil, nil, nil, nil, "111", [1,2,3]) }
|
31
|
+
@expected_repo2 = { "222" => DevRepository.new(:git, "err", nil, nil, nil, nil, nil, "222", [4,5,6]) }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'empty?' do
|
@@ -42,7 +42,7 @@ module RightScale
|
|
42
42
|
|
43
43
|
it 'should should not be empty when a repo is added' do
|
44
44
|
dev_repos = DevRepositories.new
|
45
|
-
dev_repos.add_repo("111", {:url=>"bunk"}, [1,2,3])
|
45
|
+
dev_repos.add_repo("111", {:repo_type=>:git, :url=>"bunk"}, [1,2,3])
|
46
46
|
dev_repos.empty?.should be_false
|
47
47
|
end
|
48
48
|
end
|
@@ -50,13 +50,13 @@ module RightScale
|
|
50
50
|
context 'add_repo' do
|
51
51
|
it 'when initially empty, should add without error' do
|
52
52
|
dev_repos = DevRepositories.new
|
53
|
-
dev_repos.add_repo("111", {:url=>"bunk"}, [1,2,3])
|
53
|
+
dev_repos.add_repo("111", {:repo_type=>:git, :url=>"bunk"}, [1,2,3])
|
54
54
|
dev_repos.serialized_members.first.should == @expected_repo1
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'when initialized with data, should add without error' do
|
58
58
|
dev_repos = DevRepositories.new(@expected_repo1)
|
59
|
-
dev_repos.add_repo("222", {:url=>"err"}, [4,5,6])
|
59
|
+
dev_repos.add_repo("222", {:repo_type=>:git, :url=>"err"}, [4,5,6])
|
60
60
|
dev_repos.serialized_members.first.should == @expected_repo1.merge(@expected_repo2)
|
61
61
|
end
|
62
62
|
end
|
@@ -0,0 +1,33 @@
|
|
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
|
+
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
25
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'right_agent', 'core_payload_types'))
|
26
|
+
|
27
|
+
module RightScale
|
28
|
+
describe DevRepository do
|
29
|
+
it 'should serialize 9 parameters' do
|
30
|
+
DevRepository.new.serialized_members.count.should == 9
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -95,18 +95,6 @@ describe AMQP::Client do
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
context 'and an EM reconnect failure' do
|
99
|
-
it 'should log an error and schedule another reconnect' do
|
100
|
-
@sut.settings[:reconnect_delay] = true
|
101
|
-
|
102
|
-
flexmock(RightScale::Log).should_receive(:error).with(/Exception caught during AMQP reconnect/, Exception, :trace).once
|
103
|
-
flexmock(EM).should_receive(:reconnect).and_raise(Exception)
|
104
|
-
flexmock(EM).should_receive(:add_timer).with(5, Proc).once
|
105
|
-
|
106
|
-
@sut.reconnect()
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
98
|
end
|
111
99
|
|
112
100
|
end
|
@@ -0,0 +1,180 @@
|
|
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
|
+
if RightScale::Platform.linux?
|
26
|
+
describe RightScale::Platform do
|
27
|
+
before(:all) do
|
28
|
+
@platform = RightScale::Platform
|
29
|
+
end
|
30
|
+
|
31
|
+
context :volume_manager do
|
32
|
+
context :parse_volumes do
|
33
|
+
it 'can parse volumes from blkid output' do
|
34
|
+
blkid_resp = <<EOF
|
35
|
+
/dev/xvdh1: SEC_TYPE="msdos" LABEL="METADATA" UUID="681B-8C5D" TYPE="vfat"
|
36
|
+
/dev/xvdb1: LABEL="SWAP-xvdb1" UUID="d51fcca0-6b10-4934-a572-f3898dfd8840" TYPE="swap"
|
37
|
+
/dev/xvda1: UUID="f4746f9c-0557-4406-9267-5e918e87ca2e" TYPE="ext3"
|
38
|
+
/dev/xvda2: UUID="14d88b9e-9fe6-4974-a8d6-180acdae4016" TYPE="ext3"
|
39
|
+
EOF
|
40
|
+
volume_hash_ary = [
|
41
|
+
{:device => "/dev/xvdh1", :sec_type => "msdos", :label => "METADATA", :uuid => "681B-8C5D", :type => "vfat", :filesystem => "vfat"},
|
42
|
+
{:device => "/dev/xvdb1", :label => "SWAP-xvdb1", :uuid => "d51fcca0-6b10-4934-a572-f3898dfd8840", :type => "swap", :filesystem => "swap"},
|
43
|
+
{:device => "/dev/xvda1", :uuid => "f4746f9c-0557-4406-9267-5e918e87ca2e", :type => "ext3", :filesystem => "ext3"},
|
44
|
+
{:device => "/dev/xvda2", :uuid => "14d88b9e-9fe6-4974-a8d6-180acdae4016", :type => "ext3", :filesystem => "ext3"}
|
45
|
+
]
|
46
|
+
|
47
|
+
@platform.volume_manager.parse_volumes(blkid_resp).should == volume_hash_ary
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'raises a parser error when blkid output is malformed' do
|
51
|
+
blkid_resp = 'foobarbz'
|
52
|
+
|
53
|
+
lambda { @platform.volume_manager.parse_volumes(blkid_resp) }.should raise_error(RightScale::Platform::VolumeManager::ParserError)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'returns an empty list of volumes when blkid output is empty' do
|
57
|
+
blkid_resp = ''
|
58
|
+
|
59
|
+
@platform.volume_manager.parse_volumes(blkid_resp).should == []
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'can filter results with only one condition' do
|
63
|
+
blkid_resp = <<EOF
|
64
|
+
/dev/xvdh1: SEC_TYPE="msdos" LABEL="METADATA" UUID="681B-8C5D" TYPE="vfat"
|
65
|
+
/dev/xvdb1: LABEL="SWAP-xvdb1" UUID="d51fcca0-6b10-4934-a572-f3898dfd8840" TYPE="swap"
|
66
|
+
/dev/xvda1: UUID="f4746f9c-0557-4406-9267-5e918e87ca2e" TYPE="ext3"
|
67
|
+
/dev/xvda2: UUID="14d88b9e-9fe6-4974-a8d6-180acdae4016" TYPE="ext3"
|
68
|
+
EOF
|
69
|
+
volume_hash_ary = [
|
70
|
+
{:device => "/dev/xvdh1", :sec_type => "msdos", :label => "METADATA", :uuid => "681B-8C5D", :type => "vfat", :filesystem => "vfat"}
|
71
|
+
]
|
72
|
+
|
73
|
+
condition = {:uuid => "681B-8C5D"}
|
74
|
+
|
75
|
+
@platform.volume_manager.parse_volumes(blkid_resp, condition).should == volume_hash_ary
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'can filter results with many conditions' do
|
79
|
+
blkid_resp = <<EOF
|
80
|
+
/dev/xvdh1: SEC_TYPE="msdos" LABEL="METADATA" UUID="681B-8C5D" TYPE="vfat"
|
81
|
+
/dev/xvdb1: LABEL="SWAP-xvdb1" UUID="d51fcca0-6b10-4934-a572-f3898dfd8840" TYPE="swap"
|
82
|
+
/dev/xvda1: UUID="f4746f9c-0557-4406-9267-5e918e87ca2e" TYPE="ext3"
|
83
|
+
/dev/xvda2: UUID="14d88b9e-9fe6-4974-a8d6-180acdae4016" TYPE="ext3"
|
84
|
+
EOF
|
85
|
+
volume_hash_ary = [
|
86
|
+
{:device => "/dev/xvda1", :uuid => "f4746f9c-0557-4406-9267-5e918e87ca2e", :type => "ext3", :filesystem => "ext3"},
|
87
|
+
{:device => "/dev/xvda2", :uuid => "14d88b9e-9fe6-4974-a8d6-180acdae4016", :type => "ext3", :filesystem => "ext3"}
|
88
|
+
]
|
89
|
+
|
90
|
+
condition = {:filesystem => "ext3"}
|
91
|
+
|
92
|
+
@platform.volume_manager.parse_volumes(blkid_resp, condition).should == volume_hash_ary
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context :mount_volume do
|
97
|
+
it 'mounts the specified volume if it is not already mounted' do
|
98
|
+
mount_resp = <<EOF
|
99
|
+
/dev/xvda2 on / type ext3 (rw,noatime,errors=remount-ro)
|
100
|
+
proc on /proc type proc (rw,noexec,nosuid,nodev)
|
101
|
+
EOF
|
102
|
+
|
103
|
+
mount_popen_mock = flexmock(:read => mount_resp)
|
104
|
+
flexmock(IO).should_receive(:popen).with('mount',Proc).once.and_yield(mount_popen_mock)
|
105
|
+
flexmock(IO).should_receive(:popen).with('mount -t vfat /dev/xvdh1 /var/spool/softlayer',Proc).once.and_yield(flexmock(:read => ""))
|
106
|
+
|
107
|
+
@platform.volume_manager.mount_volume({:device => "/dev/xvdh1", :filesystem => "vfat"}, "/var/spool/softlayer")
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'does not attempt to re-mount the volume' do
|
111
|
+
mount_resp = <<EOF
|
112
|
+
/dev/xvda2 on / type ext3 (rw,noatime,errors=remount-ro)
|
113
|
+
proc on /proc type proc (rw,noexec,nosuid,nodev)
|
114
|
+
/dev/xvdh1 on /var/spool/softlayer type vfat (rw) [METADATA]
|
115
|
+
EOF
|
116
|
+
|
117
|
+
mount_popen_mock = flexmock(:read => mount_resp)
|
118
|
+
flexmock(IO).should_receive(:popen).with('mount',Proc).once.and_yield(mount_popen_mock)
|
119
|
+
flexmock(IO).should_receive(:popen).with('mount -t vfat /dev/xvdh1 /var/spool/softlayer',Proc).never.and_yield(flexmock(:read => ""))
|
120
|
+
|
121
|
+
@platform.volume_manager.mount_volume({:device => "/dev/xvdh1", :filesystem => "vfat"}, "/var/spool/softlayer")
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'raises argument error when the volume parameter is not a hash' do
|
125
|
+
lambda { @platform.volume_manager.mount_volume("", "") }.should raise_error(ArgumentError)
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'raises argument error when the volume parameter is a hash but does not contain :device' do
|
129
|
+
lambda { @platform.volume_manager.mount_volume({}, "") }.should raise_error(ArgumentError)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'raises volume error when the device is already mounted to a different mountpoint' do
|
133
|
+
mount_resp = <<EOF
|
134
|
+
/dev/xvda2 on / type ext3 (rw,noatime,errors=remount-ro)
|
135
|
+
proc on /proc type proc (rw,noexec,nosuid,nodev)
|
136
|
+
none on /sys type sysfs (rw,noexec,nosuid,nodev)
|
137
|
+
none on /sys/kernel/debug type debugfs (rw)
|
138
|
+
none on /sys/kernel/security type securityfs (rw)
|
139
|
+
none on /dev type devtmpfs (rw,mode=0755)
|
140
|
+
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
|
141
|
+
none on /dev/shm type tmpfs (rw,nosuid,nodev)
|
142
|
+
none on /var/run type tmpfs (rw,nosuid,mode=0755)
|
143
|
+
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
|
144
|
+
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
|
145
|
+
/dev/xvda1 on /boot type ext3 (rw,noatime)
|
146
|
+
/dev/xvdh1 on /mnt type vfat (rw) [METADATA]
|
147
|
+
EOF
|
148
|
+
|
149
|
+
mount_popen_mock = flexmock(:read => mount_resp)
|
150
|
+
flexmock(IO).should_receive(:popen).with('mount',Proc).and_yield(mount_popen_mock)
|
151
|
+
|
152
|
+
lambda { @platform.volume_manager.mount_volume({:device => "/dev/xvdh1"}, "/var/spool/softlayer")}.should raise_error(RightScale::Platform::VolumeManager::VolumeError)
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'raises volume error when a different device is already mounted to the specified mountpoint' do
|
156
|
+
mount_resp = <<EOF
|
157
|
+
/dev/xvda2 on / type ext3 (rw,noatime,errors=remount-ro)
|
158
|
+
proc on /proc type proc (rw,noexec,nosuid,nodev)
|
159
|
+
none on /sys type sysfs (rw,noexec,nosuid,nodev)
|
160
|
+
none on /sys/kernel/debug type debugfs (rw)
|
161
|
+
none on /sys/kernel/security type securityfs (rw)
|
162
|
+
none on /dev type devtmpfs (rw,mode=0755)
|
163
|
+
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
|
164
|
+
none on /dev/shm type tmpfs (rw,nosuid,nodev)
|
165
|
+
none on /var/run type tmpfs (rw,nosuid,mode=0755)
|
166
|
+
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
|
167
|
+
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
|
168
|
+
/dev/xvda1 on /boot type ext3 (rw,noatime)
|
169
|
+
/dev/xvdh2 on /var/spool/softlayer type vfat (rw) [METADATA]
|
170
|
+
EOF
|
171
|
+
|
172
|
+
mount_popen_mock = flexmock(:read => mount_resp)
|
173
|
+
flexmock(IO).should_receive(:popen).with('mount',Proc).and_yield(mount_popen_mock)
|
174
|
+
|
175
|
+
lambda { @platform.volume_manager.mount_volume({:device => "/dev/xvdh1"}, "/var/spool/softlayer")}.should raise_error(RightScale::Platform::VolumeManager::VolumeError)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
data/spec/sender_spec.rb
CHANGED
@@ -872,6 +872,101 @@ describe RightScale::Sender do
|
|
872
872
|
@instance.initialize_offline_queue
|
873
873
|
end
|
874
874
|
|
875
|
+
it 'should queue requests prior to offline handler initialization and then flush once started' do
|
876
|
+
old_flush_delay = RightScale::Sender::OfflineHandler::MAX_QUEUE_FLUSH_DELAY
|
877
|
+
RightScale::Sender.new(@agent)
|
878
|
+
@instance = RightScale::Sender.instance
|
879
|
+
begin
|
880
|
+
RightScale::Sender::OfflineHandler.const_set(:MAX_QUEUE_FLUSH_DELAY, 0.1)
|
881
|
+
EM.run do
|
882
|
+
@instance.send_push('/dummy', 'payload')
|
883
|
+
@instance.offline_handler.offline?.should be_true
|
884
|
+
@instance.offline_handler.state.should == :created
|
885
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 1
|
886
|
+
@instance.initialize_offline_queue
|
887
|
+
@broker.should_receive(:publish).once.and_return { EM.stop }
|
888
|
+
@instance.start_offline_queue
|
889
|
+
EM.add_timer(1) { EM.stop }
|
890
|
+
end
|
891
|
+
ensure
|
892
|
+
RightScale::Sender::OfflineHandler.const_set(:MAX_QUEUE_FLUSH_DELAY, old_flush_delay)
|
893
|
+
end
|
894
|
+
end
|
895
|
+
|
896
|
+
it 'should not queue requests prior to offline handler startup if not offline' do
|
897
|
+
old_flush_delay = RightScale::Sender::OfflineHandler::MAX_QUEUE_FLUSH_DELAY
|
898
|
+
RightScale::Sender.new(@agent)
|
899
|
+
@instance = RightScale::Sender.instance
|
900
|
+
begin
|
901
|
+
RightScale::Sender::OfflineHandler.const_set(:MAX_QUEUE_FLUSH_DELAY, 0.1)
|
902
|
+
EM.run do
|
903
|
+
@instance.send_push('/dummy', 'payload')
|
904
|
+
@instance.offline_handler.offline?.should be_true
|
905
|
+
@instance.offline_handler.state.should == :created
|
906
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 1
|
907
|
+
@instance.initialize_offline_queue
|
908
|
+
@broker.should_receive(:publish).with(Hash, on {|arg| arg.type == "/dummy2"}, Hash).once
|
909
|
+
@instance.send_push('/dummy2', 'payload')
|
910
|
+
@instance.offline_handler.offline?.should be_false
|
911
|
+
@instance.offline_handler.mode.should == :initializing
|
912
|
+
@instance.offline_handler.state.should == :initializing
|
913
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 1
|
914
|
+
@instance.offline_handler.instance_variable_get(:@queue).first[:type].should == "/dummy"
|
915
|
+
@broker.should_receive(:publish).with(Hash, on {|arg| arg.type == "/dummy"}, Hash).once
|
916
|
+
@instance.start_offline_queue
|
917
|
+
EM.add_timer(1) do
|
918
|
+
@instance.offline_handler.mode.should == :online
|
919
|
+
@instance.offline_handler.state.should == :running
|
920
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 0
|
921
|
+
EM.stop
|
922
|
+
end
|
923
|
+
end
|
924
|
+
ensure
|
925
|
+
RightScale::Sender::OfflineHandler.const_set(:MAX_QUEUE_FLUSH_DELAY, old_flush_delay)
|
926
|
+
end
|
927
|
+
end
|
928
|
+
|
929
|
+
it 'should queue requests at front if received after offline handler initialization but before startup' do
|
930
|
+
old_flush_delay = RightScale::Sender::OfflineHandler::MAX_QUEUE_FLUSH_DELAY
|
931
|
+
RightScale::Sender.new(@agent)
|
932
|
+
@instance = RightScale::Sender.instance
|
933
|
+
begin
|
934
|
+
RightScale::Sender::OfflineHandler.const_set(:MAX_QUEUE_FLUSH_DELAY, 0.1)
|
935
|
+
EM.run do
|
936
|
+
@instance.send_push('/dummy', 'payload')
|
937
|
+
@instance.offline_handler.offline?.should be_true
|
938
|
+
@instance.offline_handler.state.should == :created
|
939
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 1
|
940
|
+
@instance.initialize_offline_queue
|
941
|
+
@instance.offline_handler.offline?.should be_false
|
942
|
+
@instance.offline_handler.mode.should == :initializing
|
943
|
+
@instance.offline_handler.state.should == :initializing
|
944
|
+
@instance.enable_offline_mode
|
945
|
+
@instance.send_push('/dummy2', 'payload')
|
946
|
+
@instance.offline_handler.offline?.should be_true
|
947
|
+
@instance.offline_handler.mode.should == :offline
|
948
|
+
@instance.offline_handler.state.should == :initializing
|
949
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 2
|
950
|
+
@instance.offline_handler.instance_variable_get(:@queue).first[:type].should == "/dummy2"
|
951
|
+
@instance.start_offline_queue
|
952
|
+
@instance.offline_handler.mode.should == :offline
|
953
|
+
@instance.offline_handler.state.should == :running
|
954
|
+
@broker.should_receive(:publish).with(Hash, on {|arg| arg.type == "/dummy2"}, Hash).once
|
955
|
+
@broker.should_receive(:publish).with(Hash, on {|arg| arg.type == "/dummy"}, Hash).once
|
956
|
+
@instance.disable_offline_mode
|
957
|
+
@instance.offline_handler.state.should == :flushing
|
958
|
+
EM.add_timer(1) do
|
959
|
+
@instance.offline_handler.mode.should == :online
|
960
|
+
@instance.offline_handler.state.should == :running
|
961
|
+
@instance.offline_handler.instance_variable_get(:@queue).size.should == 0
|
962
|
+
EM.stop
|
963
|
+
end
|
964
|
+
end
|
965
|
+
ensure
|
966
|
+
RightScale::Sender::OfflineHandler.const_set(:MAX_QUEUE_FLUSH_DELAY, old_flush_delay)
|
967
|
+
end
|
968
|
+
end
|
969
|
+
|
875
970
|
it 'should vote for restart after the maximum number of queued requests is reached' do
|
876
971
|
@instance.offline_handler.instance_variable_get(:@restart_vote_count).should == 0
|
877
972
|
EM.run do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 6
|
10
|
+
version: 0.6.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lee Kirchhoff
|
@@ -17,11 +17,14 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-
|
20
|
+
date: 2011-12-14 00:00:00 -08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
24
|
+
type: :runtime
|
25
|
+
name: right_support
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
28
|
none: false
|
26
29
|
requirements:
|
27
30
|
- - ~>
|
@@ -31,12 +34,12 @@ dependencies:
|
|
31
34
|
- 1
|
32
35
|
- 0
|
33
36
|
version: "1.0"
|
34
|
-
|
35
|
-
prerelease: false
|
36
|
-
type: :runtime
|
37
|
-
version_requirements: *id001
|
37
|
+
requirement: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
|
39
|
+
type: :runtime
|
40
|
+
name: amqp
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
43
|
none: false
|
41
44
|
requirements:
|
42
45
|
- - "="
|
@@ -44,15 +47,15 @@ dependencies:
|
|
44
47
|
hash: 9
|
45
48
|
segments:
|
46
49
|
- 0
|
50
|
+
- 6
|
47
51
|
- 7
|
48
|
-
|
49
|
-
|
50
|
-
name: amqp
|
51
|
-
prerelease: false
|
52
|
-
type: :runtime
|
53
|
-
version_requirements: *id002
|
52
|
+
version: 0.6.7
|
53
|
+
requirement: *id002
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
|
55
|
+
type: :runtime
|
56
|
+
name: json
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
59
|
none: false
|
57
60
|
requirements:
|
58
61
|
- - ~>
|
@@ -62,12 +65,12 @@ dependencies:
|
|
62
65
|
- 1
|
63
66
|
- 4
|
64
67
|
version: "1.4"
|
65
|
-
|
66
|
-
prerelease: false
|
67
|
-
type: :runtime
|
68
|
-
version_requirements: *id003
|
68
|
+
requirement: *id003
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
|
70
|
+
type: :runtime
|
71
|
+
name: eventmachine
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
74
|
none: false
|
72
75
|
requirements:
|
73
76
|
- - ~>
|
@@ -78,12 +81,12 @@ dependencies:
|
|
78
81
|
- 12
|
79
82
|
- 10
|
80
83
|
version: 0.12.10
|
81
|
-
|
82
|
-
prerelease: false
|
83
|
-
type: :runtime
|
84
|
-
version_requirements: *id004
|
84
|
+
requirement: *id004
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
|
86
|
+
type: :runtime
|
87
|
+
name: right_popen
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
90
|
none: false
|
88
91
|
requirements:
|
89
92
|
- - ~>
|
@@ -94,12 +97,12 @@ dependencies:
|
|
94
97
|
- 0
|
95
98
|
- 11
|
96
99
|
version: 1.0.11
|
97
|
-
|
98
|
-
prerelease: false
|
99
|
-
type: :runtime
|
100
|
-
version_requirements: *id005
|
100
|
+
requirement: *id005
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
|
-
|
102
|
+
type: :runtime
|
103
|
+
name: msgpack
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
103
106
|
none: false
|
104
107
|
requirements:
|
105
108
|
- - "="
|
@@ -110,10 +113,7 @@ dependencies:
|
|
110
113
|
- 4
|
111
114
|
- 4
|
112
115
|
version: 0.4.4
|
113
|
-
|
114
|
-
prerelease: false
|
115
|
-
type: :runtime
|
116
|
-
version_requirements: *id006
|
116
|
+
requirement: *id006
|
117
117
|
description: |
|
118
118
|
RightAgent provides a foundation for running an agent on a server to interface
|
119
119
|
in a secure fashion with other agents in the RightScale system. A RightAgent
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/right_agent/core_payload_types/cookbook_repository.rb
|
160
160
|
- lib/right_agent/core_payload_types/cookbook_sequence.rb
|
161
161
|
- lib/right_agent/core_payload_types/dev_repositories.rb
|
162
|
+
- lib/right_agent/core_payload_types/dev_repository.rb
|
162
163
|
- lib/right_agent/core_payload_types/event_categories.rb
|
163
164
|
- lib/right_agent/core_payload_types/executable_bundle.rb
|
164
165
|
- lib/right_agent/core_payload_types/login_policy.rb
|
@@ -243,6 +244,7 @@ files:
|
|
243
244
|
- spec/command/command_runner_spec.rb
|
244
245
|
- spec/command/command_serializer_spec.rb
|
245
246
|
- spec/core_payload_types/dev_repositories_spec.rb
|
247
|
+
- spec/core_payload_types/dev_repository_spec.rb
|
246
248
|
- spec/core_payload_types/executable_bundle_spec.rb
|
247
249
|
- spec/core_payload_types/login_user_spec.rb
|
248
250
|
- spec/core_payload_types/right_script_attachment_spec.rb
|
@@ -258,6 +260,7 @@ files:
|
|
258
260
|
- spec/multiplexer_spec.rb
|
259
261
|
- spec/operation_result_spec.rb
|
260
262
|
- spec/packets_spec.rb
|
263
|
+
- spec/platform/linux_volume_manager_spec.rb
|
261
264
|
- spec/platform/platform_spec.rb
|
262
265
|
- spec/results_mock.rb
|
263
266
|
- spec/secure_identity_spec.rb
|