appsignal 2.1.2 → 2.2.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +14 -0
  3. data/.rubocop_todo.yml +16 -171
  4. data/.travis.yml +14 -1
  5. data/.yardopts +8 -0
  6. data/CHANGELOG.md +21 -3
  7. data/README.md +20 -2
  8. data/Rakefile +60 -62
  9. data/appsignal.gemspec +24 -23
  10. data/ext/agent.yml +11 -11
  11. data/ext/appsignal_extension.c +43 -12
  12. data/ext/extconf.rb +9 -9
  13. data/gemfiles/padrino.gemfile +1 -1
  14. data/lib/appsignal.rb +403 -26
  15. data/lib/appsignal/auth_check.rb +28 -1
  16. data/lib/appsignal/cli.rb +1 -0
  17. data/lib/appsignal/cli/demo.rb +40 -0
  18. data/lib/appsignal/cli/diagnose.rb +345 -89
  19. data/lib/appsignal/cli/helpers.rb +9 -4
  20. data/lib/appsignal/cli/install.rb +6 -6
  21. data/lib/appsignal/cli/notify_of_deploy.rb +58 -0
  22. data/lib/appsignal/config.rb +40 -38
  23. data/lib/appsignal/demo.rb +20 -0
  24. data/lib/appsignal/event_formatter.rb +4 -0
  25. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +1 -0
  26. data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +1 -0
  27. data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +1 -0
  28. data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +1 -0
  29. data/lib/appsignal/event_formatter/faraday/request_formatter.rb +1 -0
  30. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +2 -1
  31. data/lib/appsignal/event_formatter/moped/query_formatter.rb +1 -0
  32. data/lib/appsignal/extension.rb +1 -0
  33. data/lib/appsignal/garbage_collection_profiler.rb +20 -19
  34. data/lib/appsignal/hooks.rb +1 -0
  35. data/lib/appsignal/hooks/active_support_notifications.rb +1 -0
  36. data/lib/appsignal/hooks/celluloid.rb +1 -0
  37. data/lib/appsignal/hooks/data_mapper.rb +1 -0
  38. data/lib/appsignal/hooks/delayed_job.rb +1 -0
  39. data/lib/appsignal/hooks/mongo_ruby_driver.rb +1 -0
  40. data/lib/appsignal/hooks/net_http.rb +1 -0
  41. data/lib/appsignal/hooks/passenger.rb +1 -0
  42. data/lib/appsignal/hooks/puma.rb +1 -0
  43. data/lib/appsignal/hooks/rake.rb +1 -0
  44. data/lib/appsignal/hooks/redis.rb +1 -0
  45. data/lib/appsignal/hooks/sequel.rb +1 -0
  46. data/lib/appsignal/hooks/shoryuken.rb +1 -0
  47. data/lib/appsignal/hooks/sidekiq.rb +1 -0
  48. data/lib/appsignal/hooks/unicorn.rb +1 -0
  49. data/lib/appsignal/hooks/webmachine.rb +1 -0
  50. data/lib/appsignal/integrations/capistrano/appsignal.cap +4 -4
  51. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +2 -0
  52. data/lib/appsignal/integrations/data_mapper.rb +1 -1
  53. data/lib/appsignal/integrations/delayed_job_plugin.rb +1 -0
  54. data/lib/appsignal/integrations/grape.rb +3 -1
  55. data/lib/appsignal/integrations/mongo_ruby_driver.rb +1 -0
  56. data/lib/appsignal/integrations/padrino.rb +36 -21
  57. data/lib/appsignal/integrations/railtie.rb +2 -2
  58. data/lib/appsignal/integrations/resque.rb +1 -0
  59. data/lib/appsignal/integrations/resque_active_job.rb +1 -0
  60. data/lib/appsignal/integrations/webmachine.rb +27 -24
  61. data/lib/appsignal/js_exception_transaction.rb +8 -8
  62. data/lib/appsignal/marker.rb +41 -4
  63. data/lib/appsignal/minutely.rb +1 -0
  64. data/lib/appsignal/rack/generic_instrumentation.rb +3 -2
  65. data/lib/appsignal/rack/js_exception_catcher.rb +55 -15
  66. data/lib/appsignal/rack/rails_instrumentation.rb +2 -1
  67. data/lib/appsignal/rack/sinatra_instrumentation.rb +4 -2
  68. data/lib/appsignal/rack/streaming_listener.rb +4 -2
  69. data/lib/appsignal/system.rb +5 -31
  70. data/lib/appsignal/transaction.rb +71 -6
  71. data/lib/appsignal/transmitter.rb +24 -13
  72. data/lib/appsignal/utils.rb +18 -11
  73. data/lib/appsignal/utils/params_sanitizer.rb +2 -1
  74. data/lib/appsignal/utils/query_params_sanitizer.rb +1 -0
  75. data/lib/appsignal/version.rb +1 -1
  76. data/resources/appsignal.yml.erb +1 -1
  77. data/spec/lib/appsignal/auth_check_spec.rb +64 -22
  78. data/spec/lib/appsignal/cli/diagnose_spec.rb +539 -81
  79. data/spec/lib/appsignal/cli/helpers_spec.rb +74 -2
  80. data/spec/lib/appsignal/cli/install_spec.rb +3 -3
  81. data/spec/lib/appsignal/config_spec.rb +38 -72
  82. data/spec/lib/appsignal/demo_spec.rb +2 -2
  83. data/spec/lib/appsignal/event_formatter_spec.rb +2 -2
  84. data/spec/lib/appsignal/extension_spec.rb +4 -0
  85. data/spec/lib/appsignal/garbage_collection_profiler_spec.rb +18 -21
  86. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +1 -1
  87. data/spec/lib/appsignal/hooks/redis_spec.rb +34 -44
  88. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +2 -2
  89. data/spec/lib/appsignal/integrations/grape_spec.rb +6 -6
  90. data/spec/lib/appsignal/integrations/padrino_spec.rb +241 -122
  91. data/spec/lib/appsignal/integrations/railtie_spec.rb +34 -16
  92. data/spec/lib/appsignal/integrations/resque_spec.rb +1 -1
  93. data/spec/lib/appsignal/integrations/sinatra_spec.rb +38 -10
  94. data/spec/lib/appsignal/integrations/webmachine_spec.rb +2 -2
  95. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +7 -6
  96. data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +95 -58
  97. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +9 -6
  98. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +11 -10
  99. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +20 -13
  100. data/spec/lib/appsignal/system_spec.rb +2 -32
  101. data/spec/lib/appsignal/transaction_spec.rb +48 -7
  102. data/spec/lib/appsignal/transmitter_spec.rb +52 -33
  103. data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +3 -1
  104. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +3 -3
  105. data/spec/lib/appsignal/utils_spec.rb +49 -6
  106. data/spec/lib/appsignal_spec.rb +60 -5
  107. data/spec/spec_helper.rb +4 -3
  108. data/spec/support/helpers/api_request_helper.rb +1 -4
  109. data/spec/support/helpers/dependency_helper.rb +4 -0
  110. data/spec/support/helpers/system_helpers.rb +1 -17
  111. data/spec/support/helpers/time_helpers.rb +1 -1
  112. metadata +19 -8
  113. data/spec/lib/appsignal/system/container_spec.rb +0 -67
  114. data/spec/lib/appsignal/utils/gzip_spec.rb +0 -10
@@ -103,22 +103,22 @@ if DependencyHelper.sinatra_present?
103
103
  after { middleware.call(env) }
104
104
  end
105
105
 
106
- describe "#call_with_appsignal_monitoring" do
106
+ describe "#call_with_appsignal_monitoring", :error => false do
107
107
  it "should create a transaction" do
108
108
  expect(Appsignal::Transaction).to receive(:create).with(
109
109
  kind_of(String),
110
110
  Appsignal::Transaction::HTTP_REQUEST,
111
111
  kind_of(Sinatra::Request),
112
112
  kind_of(Hash)
113
- ).and_return(double(:set_action => nil, :set_http_or_background_queue_start => nil, :set_metadata => nil))
113
+ ).and_return(double(:set_action_if_nil => nil, :set_http_or_background_queue_start => nil, :set_metadata => nil))
114
114
  end
115
115
 
116
116
  it "should call the app" do
117
117
  expect(app).to receive(:call).with(env)
118
118
  end
119
119
 
120
- context "with an error" do
121
- let(:error) { VerySpecificError.new }
120
+ context "with an error", :error => true do
121
+ let(:error) { VerySpecificError }
122
122
  let(:app) do
123
123
  double.tap do |d|
124
124
  allow(d).to receive(:call).and_raise(error)
@@ -132,7 +132,7 @@ if DependencyHelper.sinatra_present?
132
132
  end
133
133
 
134
134
  context "with an error in sinatra.error" do
135
- let(:error) { VerySpecificError.new }
135
+ let(:error) { VerySpecificError }
136
136
  let(:env) { { "sinatra.error" => error } }
137
137
 
138
138
  it "should set the error" do
@@ -158,14 +158,14 @@ if DependencyHelper.sinatra_present?
158
158
 
159
159
  describe "action name" do
160
160
  it "should set the action" do
161
- expect_any_instance_of(Appsignal::Transaction).to receive(:set_action).with("GET /")
161
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_action_if_nil).with("GET /")
162
162
  end
163
163
 
164
164
  context "without 'sinatra.route' env" do
165
165
  let(:env) { { :path => "/", :method => "GET" } }
166
166
 
167
167
  it "returns nil" do
168
- expect_any_instance_of(Appsignal::Transaction).to receive(:set_action).with(nil)
168
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_action_if_nil).with(nil)
169
169
  end
170
170
  end
171
171
 
@@ -173,14 +173,14 @@ if DependencyHelper.sinatra_present?
173
173
  before { env["SCRIPT_NAME"] = "/api" }
174
174
 
175
175
  it "should call set_action with an application prefix path" do
176
- expect_any_instance_of(Appsignal::Transaction).to receive(:set_action).with("GET /api/")
176
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_action_if_nil).with("GET /api/")
177
177
  end
178
178
 
179
179
  context "without 'sinatra.route' env" do
180
180
  let(:env) { { :path => "/", :method => "GET" } }
181
181
 
182
182
  it "returns nil" do
183
- expect_any_instance_of(Appsignal::Transaction).to receive(:set_action).with(nil)
183
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_action_if_nil).with(nil)
184
184
  end
185
185
  end
186
186
  end
@@ -206,7 +206,8 @@ if DependencyHelper.sinatra_present?
206
206
  end
207
207
  end
208
208
 
209
- after { middleware.call(env) rescue VerySpecificError }
209
+ after(:error => false) { middleware.call(env) }
210
+ after(:error => true) { expect { middleware.call(env) }.to raise_error(VerySpecificError) }
210
211
  end
211
212
  end
212
213
  end
@@ -71,7 +71,7 @@ describe Appsignal::Rack::StreamingListener do
71
71
 
72
72
  env["appsignal.action"] = "Action"
73
73
 
74
- expect(transaction).to receive(:set_action).with("Action")
74
+ expect(transaction).to receive(:set_action_if_nil).with("Action")
75
75
 
76
76
  listener.call_with_appsignal_monitoring(env)
77
77
  end
@@ -87,12 +87,16 @@ describe Appsignal::Rack::StreamingListener do
87
87
  end
88
88
 
89
89
  context "with an exception in the instrumentation call" do
90
+ let(:error) { VerySpecificError }
91
+
90
92
  it "should add the exception to the transaction" do
91
- allow(app).to receive(:call).and_raise(VerySpecificError.new)
93
+ allow(app).to receive(:call).and_raise(error)
92
94
 
93
- expect(transaction).to receive(:set_error)
95
+ expect(transaction).to receive(:set_error).with(error)
94
96
 
95
- listener.call_with_appsignal_monitoring(env) rescue VerySpecificError
97
+ expect do
98
+ listener.call_with_appsignal_monitoring(env)
99
+ end.to raise_error(error)
96
100
  end
97
101
  end
98
102
 
@@ -121,13 +125,15 @@ describe Appsignal::StreamWrapper do
121
125
  end
122
126
 
123
127
  context "when each raises an error" do
128
+ let(:error) { VerySpecificError }
129
+
124
130
  it "should add the exception to the transaction" do
125
131
  allow(stream).to receive(:each)
126
- .and_raise(VerySpecificError.new)
132
+ .and_raise(error)
127
133
 
128
- expect(transaction).to receive(:set_error)
134
+ expect(transaction).to receive(:set_error).with(error)
129
135
 
130
- wrapper.send(:each) rescue VerySpecificError
136
+ expect { wrapper.send(:each) }.to raise_error(error)
131
137
  end
132
138
  end
133
139
  end
@@ -141,14 +147,15 @@ describe Appsignal::StreamWrapper do
141
147
  end
142
148
 
143
149
  context "when each raises an error" do
144
- it "should add the exception to the transaction and close it" do
145
- allow(stream).to receive(:close)
146
- .and_raise(VerySpecificError.new)
150
+ let(:error) { VerySpecificError }
151
+
152
+ it "adds the exception to the transaction and close it" do
153
+ allow(stream).to receive(:close).and_raise(error)
147
154
 
148
- expect(transaction).to receive(:set_error)
149
- expect(Appsignal::Transaction).to receive(:complete_current!)
155
+ expect(transaction).to receive(:set_error).with(error)
156
+ expect(transaction).to receive(:complete)
150
157
 
151
- wrapper.send(:close) rescue VerySpecificError
158
+ expect { wrapper.send(:close) }.to raise_error(error)
152
159
  end
153
160
  end
154
161
  end
@@ -1,32 +1,4 @@
1
1
  describe Appsignal::System do
2
- describe ".container?" do
3
- subject { described_class.container? }
4
-
5
- context "when on Heroku" do
6
- around { |example| recognize_as_heroku { example.run } }
7
-
8
- it "returns true" do
9
- expect(subject).to be_truthy
10
- end
11
- end
12
-
13
- context "when in docker" do
14
- around { |example| recognize_as_container(:docker) { example.run } }
15
-
16
- it "returns true" do
17
- expect(subject).to be_truthy
18
- end
19
- end
20
-
21
- context "when not in container" do
22
- around { |example| recognize_as_container(:none) { example.run } }
23
-
24
- it "returns false" do
25
- expect(subject).to be_falsy
26
- end
27
- end
28
- end
29
-
30
2
  describe ".heroku?" do
31
3
  subject { described_class.heroku? }
32
4
 
@@ -34,15 +6,13 @@ describe Appsignal::System do
34
6
  around { |example| recognize_as_heroku { example.run } }
35
7
 
36
8
  it "returns true" do
37
- expect(subject).to be_truthy
9
+ is_expected.to eq(true)
38
10
  end
39
11
  end
40
12
 
41
13
  context "when not on Heroku" do
42
- around { |example| recognize_as_container(:none) { example.run } }
43
-
44
14
  it "returns false" do
45
- expect(subject).to be_falsy
15
+ is_expected.to eq(false)
46
16
  end
47
17
  end
48
18
  end
@@ -256,10 +256,52 @@ describe Appsignal::Transaction do
256
256
  ).once
257
257
 
258
258
  transaction.set_action("PagesController#show")
259
+
260
+ expect(transaction.action).to eq "PagesController#show"
261
+ end
262
+
263
+ it "should not set the action in extension when value is nil" do
264
+ expect(Appsignal::Extension).to_not receive(:set_action)
265
+
266
+ transaction.set_action(nil)
267
+ end
268
+ end
269
+
270
+ describe "set_action_if_nil" do
271
+ context "if action is currently nil" do
272
+ it "should set the action" do
273
+ expect(transaction.ext).to receive(:set_action).with(
274
+ "PagesController#show"
275
+ ).once
276
+
277
+ transaction.set_action_if_nil("PagesController#show")
278
+ end
279
+ end
280
+
281
+ context "if action is currently set" do
282
+ it "should not set the action" do
283
+ transaction.set_action("something")
284
+
285
+ expect(transaction.ext).not_to receive(:set_action)
286
+
287
+ transaction.set_action_if_nil("PagesController#show")
288
+ end
289
+ end
290
+ end
291
+
292
+ describe "set_namespace" do
293
+ it "should set the action in extension" do
294
+ expect(transaction.ext).to receive(:set_namespace).with(
295
+ "custom"
296
+ ).once
297
+
298
+ transaction.set_namespace("custom")
299
+
300
+ expect(transaction.namespace).to eq "custom"
259
301
  end
260
302
 
261
303
  it "should not set the action in extension when value is nil" do
262
- expect(Appsignal::Extension).to_not receive(:set_transaction_action)
304
+ expect(Appsignal::Extension).to_not receive(:set_namespace)
263
305
 
264
306
  transaction.set_action(nil)
265
307
  end
@@ -606,7 +648,7 @@ describe Appsignal::Transaction do
606
648
  end
607
649
  end
608
650
 
609
- # protected
651
+ # private
610
652
 
611
653
  describe "#background_queue_start" do
612
654
  subject { transaction.send(:background_queue_start) }
@@ -732,16 +774,16 @@ describe Appsignal::Transaction do
732
774
 
733
775
  context "with an array" do
734
776
  let(:request) do
735
- Appsignal::Transaction::GenericRequest.new(background_env_with_data(:params => ["arg1", "arg2"]))
777
+ Appsignal::Transaction::GenericRequest.new(background_env_with_data(:params => %w(arg1 arg2)))
736
778
  end
737
779
 
738
- it { is_expected.to eq ["arg1", "arg2"] }
780
+ it { is_expected.to eq %w(arg1 arg2) }
739
781
 
740
782
  context "with AppSignal filtering" do
741
783
  before { Appsignal.config.config_hash[:filter_parameters] = %w(foo) }
742
784
  after { Appsignal.config.config_hash[:filter_parameters] = [] }
743
785
 
744
- it { is_expected.to eq ["arg1", "arg2"] }
786
+ it { is_expected.to eq %w(arg1 arg2) }
745
787
  end
746
788
  end
747
789
 
@@ -753,7 +795,6 @@ describe Appsignal::Transaction do
753
795
  end
754
796
 
755
797
  it "should call the params sanitizer" do
756
- puts Appsignal.config.config_hash[:filter_parameters].inspect
757
798
  expect(subject).to eq(:foo => :bar)
758
799
  end
759
800
  end
@@ -917,7 +958,7 @@ describe Appsignal::Transaction do
917
958
  :both_symbols => :valid_value,
918
959
  :integer_value => 1,
919
960
  :hash_value => { "invalid" => "hash" },
920
- :array_value => ["invalid", "array"],
961
+ :array_value => %w(invalid array),
921
962
  :to_long_value => SecureRandom.urlsafe_base64(101),
922
963
  :object => Object.new,
923
964
  SecureRandom.urlsafe_base64(101) => "to_long_key"
@@ -1,53 +1,75 @@
1
1
  describe Appsignal::Transmitter do
2
2
  let(:config) { project_fixture_config }
3
- let(:action) { "action" }
3
+ let(:base_uri) { "action" }
4
4
  let(:log) { StringIO.new }
5
- let(:instance) { Appsignal::Transmitter.new(action, config) }
5
+ let(:instance) { Appsignal::Transmitter.new(base_uri, config) }
6
6
  before do
7
7
  config.config_hash[:hostname] = "app1.local"
8
8
  config.logger = Logger.new(log)
9
9
  end
10
10
 
11
11
  describe "#uri" do
12
- subject { instance.uri.to_s }
13
-
14
- it { is_expected.to include "https://push.appsignal.com/1/action?" }
15
- it { is_expected.to include "api_key=abc" }
16
- it { is_expected.to include "hostname=app1.local" }
17
- it { is_expected.to include "name=TestApp" }
18
- it { is_expected.to include "environment=production" }
19
- it { is_expected.to include "gem_version=#{Appsignal::VERSION}" }
12
+ let(:uri) { instance.uri }
13
+
14
+ it "returns a URI object with configuration data" do
15
+ expect(uri.to_s).to start_with(config[:endpoint])
16
+ expect(uri.path).to eq("/1/action")
17
+ expect(CGI.parse(uri.query)).to eq(
18
+ "api_key" => ["abc"],
19
+ "hostname" => ["app1.local"],
20
+ "name" => ["TestApp"],
21
+ "environment" => ["production"],
22
+ "gem_version" => [Appsignal::VERSION]
23
+ )
24
+ end
25
+
26
+ context "when base_uri argument is a full URI" do
27
+ let(:base_uri) { "http://foo.bar/path" }
28
+
29
+ it "uses the full URI" do
30
+ expect(uri.to_s).to start_with("#{base_uri}?")
31
+ end
32
+ end
33
+
34
+ context "when base_uri argument is only a path" do
35
+ it "uses the config[:endpoint] base" do
36
+ expect(uri.to_s).to start_with("#{config[:endpoint]}/1/#{base_uri}?")
37
+ end
38
+ end
20
39
  end
21
40
 
22
41
  describe "#transmit" do
23
42
  before do
24
- stub_request(
25
- :post,
26
- "https://push.appsignal.com/1/action?api_key=abc"\
27
- "&environment=production&gem_version=#{Appsignal::VERSION}"\
28
- "&hostname=#{config.config_hash[:hostname]}&name=TestApp"
29
- ).with(
30
- :body => Appsignal::Utils::Gzip.compress("{\"the\":\"payload\"}"),
43
+ stub_request(:post, "https://push.appsignal.com/1/action").with(
44
+ :query => {
45
+ :api_key => "abc",
46
+ :environment => "production",
47
+ :gem_version => Appsignal::VERSION,
48
+ :hostname => config[:hostname],
49
+ :name => "TestApp"
50
+ },
51
+ :body => "{\"the\":\"payload\"}",
31
52
  :headers => {
32
- "Content-Encoding" => "gzip",
33
53
  "Content-Type" => "application/json; charset=UTF-8"
34
54
  }
35
- ).to_return(
36
- :status => 200
37
- )
55
+ ).to_return(:status => 200)
38
56
  end
39
- subject { instance.transmit(:the => :payload) }
57
+ let(:response) { instance.transmit(:the => :payload) }
40
58
 
41
- it { is_expected.to eq "200" }
59
+ it "returns Net::HTTP response" do
60
+ expect(response).to be_kind_of(Net::HTTPResponse)
61
+ expect(response.code).to eq "200"
62
+ end
42
63
 
43
64
  context "with ca_file_path config option set" do
44
- context "when not existing file" do
65
+ context "when file does not exist" do
45
66
  before do
46
67
  config.config_hash[:ca_file_path] = File.join(resources_dir, "cacert.pem")
47
68
  end
48
69
 
49
70
  it "ignores the config and logs a warning" do
50
- expect(subject).to eq "200"
71
+ expect(response).to be_kind_of(Net::HTTPResponse)
72
+ expect(response.code).to eq "200"
51
73
  expect(log.string).to_not include "Ignoring non-existing or unreadable " \
52
74
  "`ca_file_path`: #{config[:ca_file_path]}"
53
75
  end
@@ -59,7 +81,8 @@ describe Appsignal::Transmitter do
59
81
  end
60
82
 
61
83
  it "ignores the config and logs a warning" do
62
- expect(subject).to eq "200"
84
+ expect(response).to be_kind_of(Net::HTTPResponse)
85
+ expect(response.code).to eq "200"
63
86
  expect(log.string).to include "Ignoring non-existing or unreadable " \
64
87
  "`ca_file_path`: #{config[:ca_file_path]}"
65
88
  end
@@ -69,11 +92,12 @@ describe Appsignal::Transmitter do
69
92
  let(:file) { File.join(tmp_dir, "ca_file") }
70
93
  before do
71
94
  config.config_hash[:ca_file_path] = file
72
- File.open(file, "w") { |f| f.chmod 0000 }
95
+ File.open(file, "w") { |f| f.chmod 0o000 }
73
96
  end
74
97
 
75
98
  it "ignores the config and logs a warning" do
76
- expect(subject).to eq "200"
99
+ expect(response).to be_kind_of(Net::HTTPResponse)
100
+ expect(response.code).to eq "200"
77
101
  expect(log.string).to include "Ignoring non-existing or unreadable " \
78
102
  "`ca_file_path`: #{config[:ca_file_path]}"
79
103
  end
@@ -86,17 +110,12 @@ describe Appsignal::Transmitter do
86
110
  describe "#http_post" do
87
111
  subject { instance.send(:http_post, "the" => "payload") }
88
112
 
89
- it "gzips the body" do
90
- expect(subject.body).to eq Appsignal::Utils::Gzip.compress("{\"the\":\"payload\"}")
91
- end
92
-
93
113
  it "sets the path" do
94
114
  expect(subject.path).to eq instance.uri.request_uri
95
115
  end
96
116
 
97
117
  it "sets the correct headers" do
98
118
  expect(subject["Content-Type"]).to eq "application/json; charset=UTF-8"
99
- expect(subject["Content-Encoding"]).to eq "gzip"
100
119
  end
101
120
  end
102
121
 
@@ -9,7 +9,8 @@ describe Appsignal::Utils::ParamsSanitizer do
9
9
  :bool_true => true,
10
10
  :bool_false => false,
11
11
  :nil => nil,
12
- :int => 1,
12
+ :int => 1, # Fixnum
13
+ :int64 => 1 << 64, # Bignum
13
14
  :hash => {
14
15
  :nested_text => "string",
15
16
  :nested_array => [
@@ -41,6 +42,7 @@ describe Appsignal::Utils::ParamsSanitizer do
41
42
  it { expect(subject[:bool_false]).to be(false) }
42
43
  it { expect(subject[:nil]).to be_nil }
43
44
  it { expect(subject[:int]).to eq(1) }
45
+ it { expect(subject[:int64]).to eq(1 << 64) }
44
46
 
45
47
  it "does not change the original params" do
46
48
  subject