right_agent 2.2.1-x86-mingw32 → 2.4.3-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/README.rdoc +2 -0
  2. data/lib/right_agent.rb +1 -0
  3. data/lib/right_agent/actor.rb +0 -28
  4. data/lib/right_agent/actors/agent_manager.rb +20 -18
  5. data/lib/right_agent/agent.rb +70 -87
  6. data/lib/right_agent/agent_config.rb +1 -1
  7. data/lib/right_agent/agent_tag_manager.rb +1 -1
  8. data/lib/right_agent/clients/api_client.rb +2 -1
  9. data/lib/right_agent/clients/auth_client.rb +2 -6
  10. data/lib/right_agent/clients/balanced_http_client.rb +22 -11
  11. data/lib/right_agent/clients/base_retry_client.rb +14 -22
  12. data/lib/right_agent/clients/non_blocking_client.rb +1 -0
  13. data/lib/right_agent/clients/right_http_client.rb +4 -8
  14. data/lib/right_agent/clients/router_client.rb +10 -16
  15. data/lib/right_agent/command/command_parser.rb +3 -3
  16. data/lib/right_agent/command/command_runner.rb +1 -1
  17. data/lib/right_agent/command/command_serializer.rb +0 -32
  18. data/lib/right_agent/connectivity_checker.rb +7 -11
  19. data/lib/right_agent/core_payload_types/dev_repository.rb +32 -0
  20. data/lib/right_agent/dispatcher.rb +8 -45
  21. data/lib/right_agent/enrollment_result.rb +2 -2
  22. data/lib/right_agent/error_tracker.rb +230 -0
  23. data/lib/right_agent/exceptions.rb +1 -1
  24. data/lib/right_agent/log.rb +8 -6
  25. data/lib/right_agent/packets.rb +5 -3
  26. data/lib/right_agent/pending_requests.rb +10 -4
  27. data/lib/right_agent/pid_file.rb +3 -3
  28. data/lib/right_agent/platform.rb +14 -14
  29. data/lib/right_agent/protocol_version_mixin.rb +6 -3
  30. data/lib/right_agent/scripts/agent_deployer.rb +13 -1
  31. data/lib/right_agent/sender.rb +16 -35
  32. data/lib/right_agent/serialize/secure_serializer.rb +6 -9
  33. data/lib/right_agent/serialize/serializer.rb +7 -3
  34. data/right_agent.gemspec +5 -5
  35. data/spec/agent_spec.rb +5 -5
  36. data/spec/clients/auth_client_spec.rb +1 -1
  37. data/spec/clients/balanced_http_client_spec.rb +20 -28
  38. data/spec/clients/base_retry_client_spec.rb +5 -6
  39. data/spec/clients/non_blocking_client_spec.rb +4 -0
  40. data/spec/clients/router_client_spec.rb +1 -4
  41. data/spec/dispatcher_spec.rb +6 -55
  42. data/spec/error_tracker_spec.rb +346 -0
  43. data/spec/log_spec.rb +4 -0
  44. data/spec/pending_requests_spec.rb +2 -2
  45. data/spec/sender_spec.rb +3 -3
  46. data/spec/serialize/serializer_spec.rb +14 -0
  47. data/spec/spec_helper.rb +4 -2
  48. metadata +13 -11
@@ -187,6 +187,10 @@ describe RightScale::Log do
187
187
  log_count("Test error \\\(NoMethodError: undefined method \\\`\\\+\' for nil:NilClass in$").should == 1
188
188
  end
189
189
 
190
+ it 'should not attempt to use backtrace if exception has none' do
191
+ RightScale::Log.error("Test error", RuntimeError.new("failed"), :trace)
192
+ log_count("Test error \\\(RuntimeError: failed\\\)$").should == 1
193
+ end
190
194
  end
191
195
 
192
196
  end
@@ -120,7 +120,7 @@ describe RightScale::PendingRequests do
120
120
  flexmock(Time).should_receive(:now).and_return(now, now + 10, now + 10, now + 20, now + 20, now + 30)
121
121
  pending_requests = RightScale::PendingRequests.new
122
122
  add_requests(pending_requests, [@request, @push])
123
- pending_requests.youngest_age.should == 10
123
+ RightScale::PendingRequests.youngest_age(pending_requests).should == 10
124
124
  end
125
125
  end
126
126
 
@@ -130,7 +130,7 @@ describe RightScale::PendingRequests do
130
130
  flexmock(Time).should_receive(:now).and_return(now, now + 10, now + 10, now + 20, now + 20, now + 30)
131
131
  pending_requests = RightScale::PendingRequests.new
132
132
  add_requests(pending_requests, [@request, @push])
133
- pending_requests.oldest_age.should == 20
133
+ RightScale::PendingRequests.oldest_age(pending_requests).should == 20
134
134
  end
135
135
  end
136
136
  end
@@ -921,7 +921,7 @@ describe RightScale::Sender do
921
921
 
922
922
  context "when fails" do
923
923
  it "raises TemporarilyOffline if no connected brokers" do
924
- @log.should_receive(:error).with(/Failed to publish/, RightAMQP::HABrokerClient::NoConnectedBrokers).once
924
+ @log.should_receive(:error).with(/Failed to publish/, RightAMQP::HABrokerClient::NoConnectedBrokers, :no_trace).once
925
925
  @client.should_receive(:publish).and_raise(RightAMQP::HABrokerClient::NoConnectedBrokers).once
926
926
  lambda { @sender.send(:amqp_send_once, @packet) }.should raise_error(RightScale::Sender::TemporarilyOffline)
927
927
  end
@@ -947,7 +947,7 @@ describe RightScale::Sender do
947
947
  end
948
948
 
949
949
  it "does not rescue if publish fails" do
950
- @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers).once
950
+ @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers, :no_trace).once
951
951
  @client.should_receive(:publish).and_raise(RightAMQP::HABrokerClient::NoConnectedBrokers).once
952
952
  lambda { @sender.send(:amqp_send_retry, @packet, @token) }.should raise_error(RightScale::Sender::TemporarilyOffline)
953
953
  end
@@ -1040,7 +1040,7 @@ describe RightScale::Sender do
1040
1040
  @client.should_receive(:publish).and_return(@broker_ids).once.ordered
1041
1041
  @client.should_receive(:publish).and_raise(RightAMQP::HABrokerClient::NoConnectedBrokers).once.ordered
1042
1042
  flexmock(EM).should_receive(:add_timer).and_yield.once
1043
- @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers).once
1043
+ @log.should_receive(:error).with(/Failed to publish request/, RightAMQP::HABrokerClient::NoConnectedBrokers, :no_trace).once
1044
1044
  @log.should_receive(:error).with(/Failed retry.*temporarily offline/).once
1045
1045
  @sender.send(:amqp_send, :send_request, @target, @packet, @received_at, &@callback).should be_true
1046
1046
  @sender.pending_requests[@token].should_not be_nil
@@ -77,6 +77,12 @@ describe RightScale::Serializer do
77
77
  lambda { serializer.dump("hello") }.should raise_error(RightScale::Serializer::SerializationError)
78
78
  end
79
79
 
80
+ it "should raise ConnectivityFailure if packet could not be serialized for connectivity reasons" do
81
+ flexmock(RightScale::SecureSerializer).should_receive(:dump).with("hello", nil).and_raise(SocketError).once
82
+ serializer = RightScale::Serializer.new(:secure)
83
+ lambda { serializer.dump("hello") }.should raise_error(RightScale::Exceptions::ConnectivityFailure)
84
+ end
85
+
80
86
  it "should return serialized packet" do
81
87
  serialized_packet = flexmock("Packet")
82
88
  flexmock(MessagePack).should_receive(:dump).with("hello").and_return(serialized_packet).once
@@ -185,6 +191,14 @@ describe RightScale::Serializer do
185
191
  lambda { serializer.load("olleh") }.should raise_error(RightScale::Serializer::SerializationError)
186
192
  end
187
193
 
194
+ it "should raise ConnectivityFailure if packet could not be unserialized for connectivity reasons" do
195
+ serialized = "securely serialized"
196
+ flexmock(RightScale::SecureSerializer).should_receive(:load).with(serialized, "id").
197
+ and_raise(RightSupport::Net::NoResult.new("failed")).once
198
+ serializer = RightScale::Serializer.new(:secure)
199
+ lambda { serializer.load(serialized, "id") }.should raise_error(RightScale::Exceptions::ConnectivityFailure)
200
+ end
201
+
188
202
  it "should return unserialized packet" do
189
203
  unserialized_packet = flexmock("Packet")
190
204
  flexmock(MessagePack).should_receive(:load).with("olleh").and_return(unserialized_packet).once
@@ -40,6 +40,8 @@ $TESTING = true
40
40
  $VERBOSE = nil # Disable constant redefined warning
41
41
  TEST_SOCKET_PORT = 80000
42
42
 
43
+ RightScale::ErrorTracker.init(RightScale::Agent, "test_agent", :trace_level => RightScale::Agent::TRACE_LEVEL)
44
+
43
45
  module RightScale
44
46
 
45
47
  module SpecHelper
@@ -79,8 +81,8 @@ end
79
81
  def version_cannot_put_version_in_packet; RightScale::Packet::DEFAULT_VERSION end
80
82
  def version_can_put_version_in_packet; 12 end
81
83
 
82
- def version_cannot_use_mapper_query_tags; 7 end
83
- def version_can_use_mapper_query_tags; 8 end
84
+ def version_cannot_use_router_query_tags; 7 end
85
+ def version_can_use_router_query_tags; 8 end
84
86
 
85
87
  def version_cannot_handle_request_retries; 8 end
86
88
  def version_can_handle_request_retries; 9 end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.4.3
5
5
  prerelease:
6
6
  platform: x86-mingw32
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-05-07 00:00:00.000000000 Z
15
+ date: 2014-10-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: right_support
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: '0.7'
46
+ version: '0.8'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,29 +51,29 @@ dependencies:
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0.7'
54
+ version: '0.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rest-client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
- - - '='
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: 1.7.0.1
62
+ version: 1.7.0.3
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
- - - '='
68
+ - - ~>
69
69
  - !ruby/object:Gem::Version
70
- version: 1.7.0.1
70
+ version: 1.7.0.3
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: faye-websocket
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
- - - '='
76
+ - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: 0.7.0
79
79
  type: :runtime
@@ -81,7 +81,7 @@ dependencies:
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
- - - '='
84
+ - - ~>
85
85
  - !ruby/object:Gem::Version
86
86
  version: 0.7.0
87
87
  - !ruby/object:Gem::Dependency
@@ -293,6 +293,7 @@ files:
293
293
  - lib/right_agent/dispatched_cache.rb
294
294
  - lib/right_agent/dispatcher.rb
295
295
  - lib/right_agent/enrollment_result.rb
296
+ - lib/right_agent/error_tracker.rb
296
297
  - lib/right_agent/eventmachine_spawn.rb
297
298
  - lib/right_agent/exceptions.rb
298
299
  - lib/right_agent/history.rb
@@ -385,6 +386,7 @@ files:
385
386
  - spec/dispatched_cache_spec.rb
386
387
  - spec/dispatcher_spec.rb
387
388
  - spec/enrollment_result_spec.rb
389
+ - spec/error_tracker_spec.rb
388
390
  - spec/history_spec.rb
389
391
  - spec/http_exceptions_spec.rb
390
392
  - spec/log_spec.rb
@@ -444,7 +446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
444
446
  version: '0'
445
447
  segments:
446
448
  - 0
447
- hash: 354755465369324207
449
+ hash: -3291070338952462239
448
450
  requirements: []
449
451
  rubyforge_project:
450
452
  rubygems_version: 1.8.26