right_support 2.11.3 → 2.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -0
  3. data/VERSION +1 -1
  4. data/lib/right_support/notifiers/airbrake.rb +194 -0
  5. data/lib/right_support/notifiers/base.rb +73 -0
  6. data/lib/right_support/notifiers/blacklisters/base.rb +48 -0
  7. data/lib/right_support/notifiers/blacklisters/canonical.rb +60 -0
  8. data/lib/right_support/notifiers/blacklisters/regular_expression.rb +86 -0
  9. data/{features/support/file_utils_bundler_mixin.rb → lib/right_support/notifiers/blacklisters/simple.rb} +21 -20
  10. data/lib/right_support/notifiers/blacklisters/snake_case.rb +60 -0
  11. data/lib/right_support/notifiers/blacklisters/wildcard.rb +65 -0
  12. data/lib/right_support/notifiers/blacklisters.rb +34 -0
  13. data/lib/right_support/notifiers/logger.rb +94 -0
  14. data/lib/right_support/notifiers/notification.rb +57 -0
  15. data/lib/right_support/notifiers/utilities/backtrace_decoder.rb +234 -0
  16. data/lib/right_support/notifiers/utilities.rb +29 -0
  17. data/lib/right_support/notifiers.rb +32 -0
  18. data/lib/right_support/rack/request_logger.rb +13 -9
  19. data/lib/right_support.rb +1 -0
  20. data/right_support.gemspec +19 -70
  21. metadata +17 -69
  22. data/.coveralls.yml +0 -2
  23. data/.rspec +0 -3
  24. data/.simplecov +0 -6
  25. data/.travis.yml +0 -13
  26. data/Gemfile +0 -51
  27. data/Gemfile.lock +0 -153
  28. data/features/balancer_error_handling.feature +0 -34
  29. data/features/balancer_health_check.feature +0 -33
  30. data/features/hash_tools.feature +0 -27
  31. data/features/http_client_timeout.feature +0 -19
  32. data/features/serialization.feature +0 -113
  33. data/features/step_definitions/hash_tools_steps.rb +0 -41
  34. data/features/step_definitions/http_client_steps.rb +0 -27
  35. data/features/step_definitions/request_balancer_steps.rb +0 -93
  36. data/features/step_definitions/ruby_steps.rb +0 -176
  37. data/features/step_definitions/serialization_steps.rb +0 -133
  38. data/features/step_definitions/server_steps.rb +0 -134
  39. data/features/support/env.rb +0 -148
  40. data/right_support.rconf +0 -9
  41. data/spec/config/feature_set_spec.rb +0 -83
  42. data/spec/crypto/signed_hash_spec.rb +0 -73
  43. data/spec/data/hash_tools_spec.rb +0 -602
  44. data/spec/data/mash_spec.rb +0 -313
  45. data/spec/data/token_spec.rb +0 -21
  46. data/spec/data/uuid_spec.rb +0 -45
  47. data/spec/db/cassandra_model_part1_spec.rb +0 -84
  48. data/spec/db/cassandra_model_part2_spec.rb +0 -73
  49. data/spec/db/cassandra_model_spec.rb +0 -375
  50. data/spec/fixtures/encrypted_priv_rsa.pem +0 -30
  51. data/spec/fixtures/good_priv_dsa.pem +0 -12
  52. data/spec/fixtures/good_priv_rsa.pem +0 -15
  53. data/spec/fixtures/good_pub_dsa.ssh +0 -1
  54. data/spec/fixtures/good_pub_rsa.pem +0 -5
  55. data/spec/fixtures/good_pub_rsa.ssh +0 -1
  56. data/spec/log/exception_logger_spec.rb +0 -76
  57. data/spec/log/filter_logger_spec.rb +0 -66
  58. data/spec/log/mixin_spec.rb +0 -141
  59. data/spec/log/multiplexer_spec.rb +0 -54
  60. data/spec/log/null_logger_spec.rb +0 -36
  61. data/spec/log/step_level_logger_spec.rb +0 -49
  62. data/spec/log/system_logger_spec.rb +0 -172
  63. data/spec/net/address_helper_spec.rb +0 -57
  64. data/spec/net/dns_spec.rb +0 -187
  65. data/spec/net/http_client_spec.rb +0 -181
  66. data/spec/net/lb/health_check_spec.rb +0 -417
  67. data/spec/net/lb/round_robin_spec.rb +0 -15
  68. data/spec/net/lb/sticky_spec.rb +0 -92
  69. data/spec/net/request_balancer_spec.rb +0 -690
  70. data/spec/net/s3_helper_spec.rb +0 -160
  71. data/spec/net/ssl_spec.rb +0 -42
  72. data/spec/net/string_encoder_spec.rb +0 -58
  73. data/spec/rack/log_setter_spec.rb +0 -5
  74. data/spec/rack/request_logger_spec.rb +0 -225
  75. data/spec/rack/request_tracker_spec.rb +0 -115
  76. data/spec/rack/runtime_spec.rb +0 -49
  77. data/spec/ruby/easy_singleton_spec.rb +0 -72
  78. data/spec/ruby/object_extensions_spec.rb +0 -27
  79. data/spec/ruby/string_extensions_spec.rb +0 -98
  80. data/spec/spec_helper.rb +0 -188
  81. data/spec/stats/activity_spec.rb +0 -425
  82. data/spec/stats/exceptions_spec.rb +0 -247
  83. data/spec/stats/helpers_spec.rb +0 -685
  84. data/spec/validation/openssl_spec.rb +0 -37
  85. data/spec/validation/ssh_spec.rb +0 -39
@@ -1,375 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RightSupport::DB::CassandraModel do
4
- let(:config) do
5
- {
6
- 'test' => {'server' => 'connection'},
7
- 'developemnt' => {'server' => 'connection1'},
8
- 'integration' => {'server' => 'connection2', 'namespace' => 'bronze42' }
9
- }
10
- end
11
-
12
- # Ensure we at try to put the class back the way it was beforehand.
13
- # even if that prior state was invalid.
14
- around do |example|
15
- original = RightSupport::DB::CassandraModel.config rescue nil
16
- RightSupport::DB::CassandraModel.config = config
17
- example.call
18
- RightSupport::DB::CassandraModel.config = original
19
- end
20
-
21
- class Cassandra
22
- class OrderedHash < Hash
23
- def keys
24
- super.sort
25
- end
26
- end
27
- end
28
-
29
- def init_app_state(column_family,keyspace,server,env)
30
- ENV["RACK_ENV"] = env
31
- RightSupport::DB::CassandraModel.column_family = column_family
32
- RightSupport::DB::CassandraModel.keyspace = keyspace
33
- RightSupport::DB::CassandraModel.config = {"#{env}" => {"server" => server}}
34
- end
35
-
36
- context "initialization" do
37
- # This method determines the current keyspace based on the return value of the CassandraModel.keyspace method
38
- # which looks at the value of @@current_keyspace or @@default_keyspace to determine the keyspace it is operating
39
- # under. If a connection already exists for the keyspace it will re-use it. If a connection does not exist,
40
- # it will create a new persistent connection for that keyspace that can be re-used with future requests
41
- context :conn do
42
- let(:column_family) { 'column_family' }
43
- let(:env) { 'test' }
44
- let(:server) { 'localhost:9160' }
45
- let(:keyspace) { 'SatelliteService_1' }
46
- let(:default_keyspace) { 'SatelliteService' }
47
- let(:current_keyspace_connection) { flexmock('cassandra') }
48
- let(:default_keyspace_connection) { flexmock('cassandra') }
49
-
50
- before(:each) do
51
- ENV["RACK_ENV"] = env
52
- RightSupport::DB::CassandraModel.column_family = column_family
53
- RightSupport::DB::CassandraModel.keyspace = default_keyspace
54
- RightSupport::DB::CassandraModel.config = {env => {"server" => server}}
55
-
56
- current_keyspace_connection.should_receive(:disable_node_auto_discovery!).and_return(true)
57
- current_keyspace_connection.should_receive(:name).and_return('connection1')
58
-
59
- default_keyspace_connection.should_receive(:disable_node_auto_discovery!).and_return(true)
60
- default_keyspace_connection.should_receive(:name).and_return('connection2')
61
-
62
- flexmock(Cassandra).should_receive(:new).with(keyspace + '_' + (ENV['RACK_ENV'] || 'development') + "_testns", "localhost:9160", {:timeout=>20, :server_retry_period=>nil}).and_return(current_keyspace_connection)
63
- flexmock(Cassandra).should_receive(:new).with(default_keyspace + '_' + (ENV['RACK_ENV'] || 'development') + "_testns", "localhost:9160", {:timeout=>20, :server_retry_period=>nil}).and_return(default_keyspace_connection)
64
- end
65
-
66
- it 'raises a meaningful exception when a config stanza is missing' do
67
- old_rack_env = ENV['RACK_ENV']
68
-
69
- begin
70
- ENV['RACK_ENV'] = 'foobar_12345'
71
- bad_proc = lambda { RightSupport::DB::CassandraModel.reconnect }
72
- bad_proc.should raise_error(RightSupport::DB::MissingConfiguration)
73
- # This must be the very first attempt to call #conn during the execution of this spec
74
- bad_proc = lambda { RightSupport::DB::CassandraModel.conn }
75
- bad_proc.should raise_error(RightSupport::DB::MissingConfiguration)
76
- ensure
77
- ENV['RACK_ENV'] = old_rack_env
78
- end
79
- end
80
-
81
- # This method assumes that keyspaces being requested to connect to already exist.
82
- # If they do not exist, it should NOT create them. If the connection is able
83
- # to be successfully established then it should be stored in a pool of connections
84
- it 'creates a new connection if no connection exists for provided keyspace' do
85
- RightSupport::DB::CassandraModel.conn.name.should == default_keyspace_connection.name
86
- end
87
-
88
- # If a connection has already been opened for a keyspace it should be re-used
89
- it 're-uses an existing connection if it exists for provided keyspace' do
90
- RightSupport::DB::CassandraModel.conn.name.should == RightSupport::DB::CassandraModel.conn.name
91
- end
92
-
93
- # The keyspace being used for the connection should be either the current keyspace or the default keyspace
94
- it 'uses the connection that corresponds to the provided keyspace' do
95
- RightSupport::DB::CassandraModel.with_keyspace(keyspace) do
96
- RightSupport::DB::CassandraModel.conn.name.should == current_keyspace_connection.name
97
- end
98
- end
99
- end
100
- end
101
-
102
- context "use" do
103
-
104
- before(:each) do
105
- @column_family = "TestApp"
106
- @keyspace = "TestAppService"
107
- @server = "localhost:9160"
108
- @env = "test"
109
- @timeout = {:timeout => RightSupport::DB::CassandraModel::DEFAULT_TIMEOUT}
110
-
111
- init_app_state(@column_family, @keyspace, @server, @env)
112
-
113
- @key = 'key'
114
- @value = 'foo'
115
- @offset = 'bar'
116
- @attrs = {@offset => @value}
117
- @opt = {}
118
- @get_opt = {:count => RightSupport::DB::CassandraModel::DEFAULT_COUNT}
119
-
120
- @instance = RightSupport::DB::CassandraModel.new(@key, @attrs)
121
-
122
- @conn = flexmock(:connection)
123
- flexmock(RightSupport::DB::CassandraModel).should_receive(:conn).and_return(@conn)
124
- @conn.should_receive(:insert).with(@column_family, @key, @attrs,@opt).and_return(true)
125
- @conn.should_receive(:remove).with(@column_family, @key).and_return(true)
126
- @conn.should_receive(:get).with(@column_family, @key, @get_opt).and_return(@attrs).by_default
127
- @conn.should_receive(:multi_get).with(@column_family, [1,2], @opt).and_return(Hash.new)
128
- end
129
-
130
- describe "instance methods" do
131
- context :save do
132
- it 'saves the row' do
133
- @instance.save.should be_true
134
- end
135
- end
136
-
137
- context :destroy do
138
- it 'destroys the row' do
139
- @instance.destroy.should be_true
140
- end
141
- end
142
-
143
- context :reload do
144
- it 'returns a new object for the row' do
145
- @instance.reload.should be_a_kind_of(RightSupport::DB::CassandraModel)
146
- @instance.reload!.should be_a_kind_of(RightSupport::DB::CassandraModel)
147
- end
148
- end
149
- end
150
-
151
- describe "class methods" do
152
- # We want to remain backward-compatible for existing services so we expect this call to be made
153
- # as such: RightSupport::DB::CassandraModel.keyspace = "SatelliteService" and CassandraModel
154
- # will append the RACK_ENV to the end of it. Ex: "SatelliteService_development"
155
- context :keyspace= do
156
- let(:keyspace) { 'SatelliteService' }
157
-
158
- it 'appends the environment to the keyspace provided' do
159
- RightSupport::DB::CassandraModel.keyspace = keyspace
160
- RightSupport::DB::CassandraModel.send(:class_variable_get, :@@default_keyspace).should == (keyspace + "_" + (ENV['RACK_ENV'] || 'development') + "_testns")
161
- end
162
- end
163
-
164
- # If a current keyspace is provided it takes precedence over the default keyspace. If none is
165
- # provided, the default keyspace should be returned.
166
- context :keyspace do
167
- let(:keyspace) { 'SatelliteService_' + ENV['RACK_ENV'] + "_testns"}
168
-
169
- it 'returns the default keyspace if no current keyspace is set' do
170
- RightSupport::DB::CassandraModel.send(:class_variable_set, :@@current_keyspace, nil)
171
- RightSupport::DB::CassandraModel.send(:class_variable_set, :@@default_keyspace, keyspace)
172
- RightSupport::DB::CassandraModel.keyspace.should == keyspace
173
- end
174
-
175
- it 'returns the current keyspace if a current keyspace is set' do
176
- RightSupport::DB::CassandraModel.send(:class_variable_set, :@@current_keyspace, keyspace)
177
- RightSupport::DB::CassandraModel.send(:class_variable_set, :@@default_keyspace, nil)
178
- RightSupport::DB::CassandraModel.keyspace.should == keyspace
179
- end
180
- end
181
-
182
- # This method assumes that a valid keyspace is passed in. If the keyspace does not exist we do NOT
183
- # want to create it. CassandraModel should use the keyspace provided for the duration of the code
184
- # executed within the block. Any requests processed outside of the block should execute using the
185
- # default keyspace.
186
- context :with_keyspace do
187
- let(:keyspace) { 'SatelliteService_1' }
188
- let(:default_keyspace) { 'SatelliteService' }
189
-
190
- before(:each) do
191
- RightSupport::DB::CassandraModel.keyspace = default_keyspace
192
- end
193
-
194
- it 'sets the current keyspace to the keyspace provided for execution within the block' do
195
- RightSupport::DB::CassandraModel.with_keyspace(keyspace) do
196
- RightSupport::DB::CassandraModel.keyspace.should == keyspace + "_test_testns"
197
- end
198
- end
199
-
200
- it 'resets back to the default keyspace for execution outside of the block' do
201
- RightSupport::DB::CassandraModel.with_keyspace(keyspace) {}
202
- RightSupport::DB::CassandraModel.keyspace.should == default_keyspace + "_test_testns"
203
- end
204
- context 'append_env parameter' do
205
- it 'appends the environment by default' do
206
- RightSupport::DB::CassandraModel.with_keyspace('Monkey') do
207
- RightSupport::DB::CassandraModel.keyspace.should == 'Monkey_test_testns'
208
- end
209
- end
210
-
211
- it 'appends the environment when append_env == true' do
212
- RightSupport::DB::CassandraModel.with_keyspace('Monkey', true) do
213
- RightSupport::DB::CassandraModel.keyspace.should == 'Monkey_test_testns'
214
- end
215
- end
216
-
217
- it 'does NOT append the environment when append_env == false' do
218
- RightSupport::DB::CassandraModel.with_keyspace('Monkey_notatest', false) do
219
- RightSupport::DB::CassandraModel.keyspace.should == 'Monkey_notatest'
220
- end
221
- end
222
-
223
- it 'avoids double-appending the environment' do
224
- RightSupport::DB::CassandraModel.with_keyspace('Monkey_test_testns') do
225
- RightSupport::DB::CassandraModel.keyspace.should == 'Monkey_test_testns'
226
- end
227
- end
228
- end
229
- end
230
-
231
- context :namespace do
232
- it 'returns testns for the test environment' do
233
- RightSupport::DB::CassandraModel.namespace('test').should eq 'testns'
234
- end
235
- it 'uses the config-given namespace for the integration environment' do
236
- RightSupport::DB::CassandraModel.config = config
237
- RightSupport::DB::CassandraModel.namespace('integration').should eq 'bronze42'
238
- end
239
- it 'returns nil for any other environment' do
240
- %w{production staging development frobnication}.each do |env|
241
- RightSupport::DB::CassandraModel.namespace('production').should be(nil)
242
- RightSupport::DB::CassandraModel.namespace('production').should be(nil)
243
- end
244
- end
245
- end
246
- context :insert do
247
- it 'inserts a row by using the class method' do
248
- RightSupport::DB::CassandraModel.insert(@key, @attrs, @opt).should be_true
249
- end
250
- end
251
-
252
- context :remove do
253
- it 'removes a row by using the class method' do
254
- RightSupport::DB::CassandraModel.remove(@key).should be_true
255
- end
256
- end
257
-
258
- context :all do
259
- it 'returns all existing rows for the specified array of keys' do
260
- RightSupport::DB::CassandraModel.all([1, 2]).should be_a_kind_of(Hash)
261
- end
262
- end
263
-
264
- context :get do
265
- it 'returns row for the specified key' do
266
- RightSupport::DB::CassandraModel.get(@key).should be_a_kind_of(RightSupport::DB::CassandraModel)
267
- end
268
-
269
- it 'returns only number of columns requested' do
270
- attrs = {@offset + '1' => @value, @offset + '2' => @value}
271
- get_opt = {:count => 2}
272
- @conn.should_receive(:get).with(@column_family, @key, get_opt).and_return(attrs).once
273
- RightSupport::DB::CassandraModel.get(@key, get_opt).attributes.should == attrs
274
- end
275
-
276
- it 'returns all columns for the specified key if no count specified' do
277
- pending "Unpredictable behavior on ruby < 1.9" unless RUBY_VERSION >= "1.9"
278
- default_count = RightSupport::DB::CassandraModel::DEFAULT_COUNT
279
-
280
- RightSupport::DB::CassandraModel.instance_eval { remove_const :DEFAULT_COUNT }
281
- RightSupport::DB::CassandraModel.const_set(:DEFAULT_COUNT, 2)
282
- begin
283
-
284
- attrs1 = {@offset + '1' => @value, @offset + '2' => @value}
285
- attrs2 = {@offset + '3' => @value}
286
- attrs = attrs1.merge(attrs2)
287
- get_opt1 = {:count => 2}
288
- get_opt2 = {:count => 2, :start => @offset + '2'}
289
- @conn.should_receive(:get).with(@column_family, @key, get_opt1).and_return(attrs1).once
290
- @conn.should_receive(:get).with(@column_family, @key, get_opt2).and_return(attrs2).once
291
- RightSupport::DB::CassandraModel.get(@key).attributes.should == attrs
292
- ensure
293
- RightSupport::DB::CassandraModel.instance_eval { remove_const :DEFAULT_COUNT }
294
- RightSupport::DB::CassandraModel.const_set(:DEFAULT_COUNT, default_count)
295
- end
296
- end
297
-
298
- it 'returns nil if key not found' do
299
- @conn.should_receive(:get).with(@column_family, @key, @get_opt).and_return({})
300
- RightSupport::DB::CassandraModel.get(@key).should be_nil
301
- end
302
- end
303
-
304
- context :get_indexed do
305
-
306
- before(:each) do
307
- @column = flexmock(:column, :name => 'foo', :value => 'bar')
308
- @column_or_super = flexmock(:column_or_super, :column => @column)
309
- @rows = {@key => [@column_or_super]}
310
- @index = 'index'
311
- @index_key = 'index_key'
312
- @start = ""
313
- @count = RightSupport::DB::CassandraModel::DEFAULT_COUNT
314
- @expr = flexmock(:expr)
315
- @conn.should_receive(:create_idx_expr).and_return(@expr)
316
- @clause = flexmock(:clause)
317
- @conn.should_receive(:create_idx_clause).with([@expr], @start, @count).and_return(@clause).by_default
318
- @conn.should_receive(:get_indexed_slices).with(@column_family, @clause, nil, {}).and_return(@rows).by_default
319
- end
320
-
321
- it 'returns row for the specified key' do
322
- rows = RightSupport::DB::CassandraModel.get_indexed(@index, @index_key)
323
- rows.should be_a_kind_of(Array)
324
- rows.size.should eq 1
325
- rows.first.should be_a_kind_of(RightSupport::DB::CassandraModel)
326
- end
327
-
328
- it 'returns all rows for the specified key if no count specified' do
329
- pending "Unpredictable behavior on ruby < 1.9" unless RUBY_VERSION >= "1.9"
330
-
331
- default_count = RightSupport::DB::CassandraModel::DEFAULT_COUNT
332
-
333
- RightSupport::DB::CassandraModel.instance_eval { remove_const :DEFAULT_COUNT }
334
- RightSupport::DB::CassandraModel.const_set(:DEFAULT_COUNT, 2)
335
- begin
336
- key1 = @key + '8'
337
- key2 = @key + '12'
338
- key3 = @key + '13'
339
- cols = {'foo' => 'bar'}
340
- rows1 = {key1 => [@column_or_super], key2 => [@column_or_super]}
341
- rows2 = {key3 => [@column_or_super]}
342
- @conn.should_receive(:create_idx_clause).with([@expr], @start, 2).and_return(@clause).once
343
- @conn.should_receive(:get_indexed_slices).with(@column_family, @clause, nil, {}).and_return(rows1).once
344
- @conn.should_receive(:create_idx_clause).with([@expr], key2, 2).and_return(@clause).once
345
- @conn.should_receive(:get_indexed_slices).with(@column_family, @clause, nil, {}).and_return(rows2).once
346
- rows = RightSupport::DB::CassandraModel.get_indexed(@index, @index_key)
347
- rows.size.should eq 3
348
- rows.inject({}) { |s, r| s[r.key] = r.attributes; s }.should == {key1 => cols, key2 => cols, key3 => cols}
349
- ensure
350
- RightSupport::DB::CassandraModel.instance_eval { remove_const :DEFAULT_COUNT }
351
- RightSupport::DB::CassandraModel.const_set(:DEFAULT_COUNT, default_count)
352
- end
353
- end
354
-
355
- it 'returns empty array if no rows found for key' do
356
- @conn.should_receive(:get_indexed_slices).with(@column_family, @clause, nil, {}).and_return({}).once
357
- RightSupport::DB::CassandraModel.get_indexed(@index, @index_key).should == []
358
- end
359
- end
360
-
361
- context :stream_all_indexed_slices do
362
- it 'streams rows in chunks'
363
- it 'streams columns in chunks'
364
- it 'handles timeouts'
365
- end
366
- end
367
- end
368
-
369
- context '.calculate_random_partitioner_token' do
370
- it 'works' do
371
- expected = 73001115008341200964825964898370608784
372
- described_class.calculate_random_partitioner_token('71:foomonkeys').should == expected
373
- end
374
- end
375
- end
@@ -1,30 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- Proc-Type: 4,ENCRYPTED
3
- DEK-Info: DES-EDE3-CBC,61C0BBB816A708D4
4
-
5
- SQ/Y+U7z51OL/hx4YnfVPl6uqsOjpSjU2w4NFqB6EyBtMFgOoqW6ryuIi6ycHgWJ
6
- YabUlMPdnexU+1BGqu9P2M9kQejfVddBFmbE09s54dwamk7q6RjaARN0UvHq6Ms9
7
- r5/nqRBrinWtOeU/+7cV5qGp2/HbWC2bHAUCCwBcq+ymEpLOw/dpHpxjuiB5ZOLt
8
- QzcEJ8ePlNDYvPxw4Wjvb5IDjS4MSoJfA5Y2ZXwVSI1d7mhx4Cekx3CkTMWKYIU8
9
- FS6hO39tfPTcxb4os3FYl8D8TlRHv5atrsptKqYE4DKhZhoDA5yFbFJHZlEp+G6H
10
- t+snMyuzEWNWq3wGI/gaglatUMq6airA50qticbw8kvz+67pPh2gkAgMXBHEGgPW
11
- m0xnqaWf+MyQCUfaxjvxAq68Ced+H9ULLYFrzWAIuSh1M+QartuvP1ZOIcDpY83i
12
- RybTJC5MLgGE0COM7oOtPfXO/rvdf6jqTr54HhYwq18aWrqj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hotrx8MS50WLVZxxY1p7D+JxN3KeJyc
29
- mytYpg2dxr8UF64NFKuyEmunkDTdYH2Oi7B7mAcw/QlBN+qCARP+tA==
30
- -----END RSA PRIVATE KEY-----
@@ -1,12 +0,0 @@
1
- -----BEGIN DSA PRIVATE KEY-----
2
- MIIBvAIBAAKBgQC1RlSYmT8VVtunF3xcpSdJfihaHAGzLH0nf2ooHcKIH6PyxjCe
3
- Q93rFB69uyGPUJVawz3w0Y1B7B6h5eXI4SEKA4iqmSHXdFonO7wvOT5DTkzQl3yX
4
- B1s4xU8+GW1MtUNKxHPzFpX40797Z1enO/EZRNLYt0P4IG86s/O+BqD6IwIVAJ24
5
- m8A6ZFqsunyy2L5o9UInE+gfAoGAPuEeCrIginLFwSdwyrxEwC/gblKvOf/9+iMB
6
- Jo+5fN2E9AHKrCsCa53E2lnUbXOdSKDR6yVmUQSB3EsBDoLqDOVJh/BWVTABebIO
7
- WwnjQZX9UBGnsJwD4zpvtXLU4qnyFywSr1kdLDHMsGS3WVocJ9jOEH7Rh0xMM423
8
- yYS4bUQCgYEApxLO5sTQS/Ej8+BFJQrMS3xHpONQxiMnTLE3q6qZXJRgHDgsqqwZ
9
- pAfZCjRxvvfUfBGzjKwJlGQOLZVaGZOArGQF7NRtOfCHZtMBg1vubewXs64gmH5G
10
- aXvJ17D6W2vCO04R/vXh43qKLDcPu7wGng+eWNaw/LkbdfC4k8uVfp4CFQCHe0yn
11
- rgxFphSFqf8Spchmsg/coA==
12
- -----END DSA PRIVATE KEY-----
@@ -1,15 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIICWwIBAAKBgQDm4VY+mDoYUsH+7idaNXP6Bq+YIXwqGNar6zgbPEe6qgpF9nSQ
3
- B98gMObcZ9H7qGm3e/bQTCrlBAB/jMUQQbTyPsEy3pIKeWoPl7GTQpcSS9WZoHYX
4
- yf4TN8MMOeJ3rGbyGb8Xm13R+SBpOMOZfnT3KUJLznIYVtBvv+uFz/C9ewIDAQAB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ZWhwn2M4QftGHTEwzjbfJhLhtRAAAAIEApxLO5sTQS/Ej8+BFJQrMS3xHpONQxiMnTLE3q6qZXJRgHDgsqqwZpAfZCjRxvvfUfBGzjKwJlGQOLZVaGZOArGQF7NRtOfCHZtMBg1vubewXs64gmH5GaXvJ17D6W2vCO04R/vXh43qKLDcPu7wGng+eWNaw/LkbdfC4k8uVfp4= user@host
@@ -1,5 +0,0 @@
1
- -----BEGIN RSA PUBLIC KEY-----
2
- MIGJAoGBAObhVj6YOhhSwf7uJ1o1c/oGr5ghfCoY1qvrOBs8R7qqCkX2dJAH3yAw
3
- 5txn0fuoabd79tBMKuUEAH+MxRBBtPI+wTLekgp5ag+XsZNClxJL1ZmgdhfJ/hM3
4
- www54nesZvIZvxebXdH5IGk4w5l+dPcpQkvOchhW0G+/64XP8L17AgMBAAE=
5
- -----END RSA PUBLIC KEY-----
@@ -1 +0,0 @@
1
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApfGJ2lzcKgWq50u4yhZyP7yDjA4CF2pV19TUOlXg4a40FCuKi7JIqPCyixmrWYrvRFz+5zY+gHWOHkCfjNaDryUgPsBMzk2DZDD8fsrJ5KU7QDAa1RMbixnWsWTDcXGhHxC7jtRV7qKFvribLYEoUfVbWZYQR3Wl9kfc78sF6Z2TZuL2Fb9YJc5f2uDz6+I6oy8LtGci4Y2hKVYxrN5tgvFcwkE8JsRaAnjWicfoHRUIBZ/tdT76EMhBEKdO63hO9AZ8phTyZoJyLzykDRaelBUYXjG0LQXTq4jiJhKa07kv0XIgNwnz4zB9qtiOHXm6KZZDxy7xnVXOFum+JqcUxQ== user@host
@@ -1,76 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RightSupport::Log::ExceptionLogger do
4
- before(:all) do
5
- @actual_logger = Logger.new(StringIO.new)
6
- @logger = RightSupport::Log::ExceptionLogger.new(@actual_logger)
7
- @exception = Exception.new('message')
8
- end
9
-
10
- context :exception do
11
- it 'logs an error with exception information' do
12
- flexmock(@actual_logger).should_receive(:fatal)
13
- @logger.exception('desc', @exception)
14
- end
15
- end
16
-
17
- context 'class methods' do
18
- context :format_exception do
19
- it 'includes the description' do
20
- RightSupport::Log::ExceptionLogger.format_exception('desc').should == 'desc'
21
- end
22
-
23
- it 'includes the exception message if present' do
24
- e = ArgumentError.new("err")
25
- RightSupport::Log::ExceptionLogger.format_exception('desc', e).should =~ /desc \(ArgumentError: err.*/
26
- end
27
-
28
- it 'includes the exception string if present' do
29
- RightSupport::Log::ExceptionLogger.format_exception('desc', 'err', :no_trace).should == 'desc (err)'
30
- end
31
-
32
- context 'with backtrace=:no_trace' do
33
- it 'does not include a backtrace' do
34
- e = ArgumentError.new("err")
35
- RightSupport::Log::ExceptionLogger.format_exception('desc', e, :no_trace).should == 'desc (ArgumentError: err)'
36
- end
37
- end
38
-
39
- context 'with backtrace=:caller' do
40
- it 'includes a single line of backtrace' do
41
- begin
42
- raise ArgumentError.new("err")
43
- rescue Exception => e
44
- RightSupport::Log::ExceptionLogger.format_exception('desc', e, :caller).should == "desc (ArgumentError: err IN #{e.backtrace[0]})"
45
- end
46
- end
47
-
48
- it 'defaults to :caller trace' do
49
- begin
50
- raise ArgumentError.new("err")
51
- rescue Exception => e
52
- RightSupport::Log::ExceptionLogger.format_exception('desc', e).should == "desc (ArgumentError: err IN #{e.backtrace[0]})"
53
- end
54
- end
55
-
56
- it 'excludes backtrace if the exception does not respond to backtrace' do
57
- RightSupport::Log::ExceptionLogger.format_exception('desc', 'err').should == "desc (err)"
58
- end
59
- end
60
-
61
- context 'with backtrace=:trace' do
62
- it 'includes a full backtrace' do
63
- begin
64
- raise ArgumentError.new("err")
65
- rescue Exception => e
66
- RightSupport::Log::ExceptionLogger.format_exception('desc', e, :trace).should == "desc (ArgumentError: err IN\n " + e.backtrace.join("\n ") + ")"
67
- end
68
- end
69
-
70
- it 'excludes backtrace if the exception does not respond to backtrace' do
71
- RightSupport::Log::ExceptionLogger.format_exception('desc', 'err').should == "desc (err)"
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,66 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RightSupport::Log::FilterLogger do
4
- before :each do
5
- @base_logger = mock_logger
6
- @logger = RightSupport::Log::FilterLogger.new(@base_logger)
7
- end
8
- it 'does method_missing correctly'
9
- it 'does respond_to? correctly'
10
-
11
- context 'transparently proxies Logger severity-methods to underlying object' do
12
- [:debug, :info, :warn, :error, :fatal].each do |method|
13
- it ":#{method}" do
14
- #@base_logger.should_receive(method).with('testing').once
15
- @logger.__send__(method, "testing")
16
- end
17
- end
18
- end
19
-
20
- context 'transparently proxies Logger add method to underlying object' do
21
- [:debug, :info, :warn, :error, :fatal].each do |method|
22
- severity = RightSupport::Log::FilterLogger::SEVERITY_TO_METHOD.index(method)
23
- it "add(#{method}, \t... ) With Message" do
24
- @base_logger.should_receive(:add).with(severity, 'testing').once
25
- @logger.add(severity, "testing")
26
- end
27
- it "add(#{method}, \t... ) With Block" do
28
- @base_logger.should_receive(:add).with(severity, "testing").once
29
- @logger.add(severity) {"testing"}
30
- end
31
- end
32
- end
33
- it 'filters log messages by severity'
34
- it 'should always log a null or empty message' do
35
- # Is this the behaviour we want?
36
- @base_logger.should_receive(:info).twice
37
- @logger.info(nil)
38
- @logger.info("")
39
- end
40
-
41
- context 'filtering log messages' do
42
- let(:logger) { flexmock(@logger) }
43
- let(:info) { RightSupport::Log::FilterLogger::INFO }
44
-
45
- context 'when the log message is a string' do
46
- it 'passes the filter method the string' do
47
- logger.should_receive(:filter).with(info, 'foo').once.pass_thru
48
- logger.info('foo')
49
- end
50
- end
51
-
52
- context 'when the log message is an exception' do
53
- it 'passes the filter method a string' do
54
- logger.should_receive(:filter).with(info, String).once.pass_thru
55
- logger.info(StandardError.new)
56
- end
57
- end
58
-
59
- context 'when the log message is any other object' do
60
- it 'passes the filter method a string' do
61
- logger.should_receive(:filter).with(info, String).once.pass_thru
62
- logger.info(Object.new)
63
- end
64
- end
65
- end
66
- end