appsignal 2.9.18.beta.1 → 2.10.6.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +0 -6
- data/.semaphore/semaphore.yml +964 -0
- data/CHANGELOG.md +48 -1
- data/README.md +1 -1
- data/Rakefile +82 -23
- data/appsignal.gemspec +5 -2
- data/build_matrix.yml +100 -52
- data/ext/agent.yml +19 -19
- data/gemfiles/capistrano2.gemfile +0 -5
- data/gemfiles/capistrano3.gemfile +0 -5
- data/gemfiles/grape.gemfile +0 -5
- data/gemfiles/no_dependencies.gemfile +0 -5
- data/gemfiles/padrino.gemfile +0 -6
- data/gemfiles/que.gemfile +0 -5
- data/gemfiles/que_beta.gemfile +0 -5
- data/gemfiles/rails-3.2.gemfile +0 -5
- data/gemfiles/rails-4.0.gemfile +0 -5
- data/gemfiles/rails-4.1.gemfile +0 -5
- data/gemfiles/rails-4.2.gemfile +0 -5
- data/gemfiles/resque.gemfile +0 -6
- data/lib/appsignal.rb +10 -7
- data/lib/appsignal/cli.rb +9 -2
- data/lib/appsignal/cli/diagnose.rb +21 -20
- data/lib/appsignal/cli/helpers.rb +22 -10
- data/lib/appsignal/cli/install.rb +2 -1
- data/lib/appsignal/cli/notify_of_deploy.rb +1 -1
- data/lib/appsignal/config.rb +23 -9
- data/lib/appsignal/event_formatter.rb +5 -6
- data/lib/appsignal/hooks/net_http.rb +13 -8
- data/lib/appsignal/integrations/grape.rb +2 -1
- data/lib/appsignal/integrations/net_http.rb +16 -0
- data/lib/appsignal/logger.rb +22 -0
- data/lib/appsignal/minutely.rb +5 -6
- data/lib/appsignal/rack/js_exception_catcher.rb +5 -0
- data/lib/appsignal/system.rb +6 -0
- data/lib/appsignal/transaction.rb +8 -3
- data/lib/appsignal/transmitter.rb +0 -1
- data/lib/appsignal/utils/deprecation_message.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/resources/cacert.pem +1404 -1804
- data/spec/lib/appsignal/auth_check_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +54 -11
- data/spec/lib/appsignal/cli/helpers_spec.rb +11 -3
- data/spec/lib/appsignal/cli/install_spec.rb +30 -1
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +4 -2
- data/spec/lib/appsignal/config_spec.rb +85 -14
- data/spec/lib/appsignal/event_formatter_spec.rb +5 -4
- data/spec/lib/appsignal/hooks/action_cable_spec.rb +1 -5
- data/spec/lib/appsignal/hooks/rake_spec.rb +41 -39
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +2 -15
- data/spec/lib/appsignal/integrations/grape_spec.rb +10 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +2 -2
- data/spec/lib/appsignal/integrations/que_spec.rb +26 -39
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +108 -46
- data/spec/lib/appsignal/integrations/resque_spec.rb +40 -39
- data/spec/lib/appsignal/logger_spec.rb +25 -0
- data/spec/lib/appsignal/minutely_spec.rb +7 -7
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +23 -5
- data/spec/lib/appsignal/system_spec.rb +36 -0
- data/spec/lib/appsignal/transaction_spec.rb +37 -26
- data/spec/lib/appsignal/transmitter_spec.rb +3 -1
- data/spec/lib/appsignal_spec.rb +13 -10
- data/spec/spec_helper.rb +26 -12
- data/spec/support/fixtures/projects/broken/config/appsignal.yml +1 -0
- data/spec/support/helpers/cli_helpers.rb +15 -1
- data/spec/support/helpers/log_helpers.rb +13 -6
- data/spec/support/helpers/transaction_helpers.rb +53 -0
- data/spec/support/helpers/wait_for_helper.rb +2 -2
- data/spec/support/matchers/be_completed.rb +5 -0
- data/spec/support/matchers/have_colorized_text.rb +28 -0
- data/spec/support/testing.rb +113 -0
- data/support/check_versions +22 -0
- data/support/install_deps +9 -4
- metadata +32 -19
- data/.travis.yml +0 -149
@@ -2,7 +2,7 @@ require "bundler/cli"
|
|
2
2
|
require "bundler/cli/common"
|
3
3
|
require "appsignal/cli"
|
4
4
|
|
5
|
-
describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_input do
|
5
|
+
describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_input, :color => false do
|
6
6
|
include CLIHelpers
|
7
7
|
|
8
8
|
class DiagnosticsReportEndpoint
|
@@ -24,7 +24,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
24
24
|
let(:out_stream) { std_stream }
|
25
25
|
let(:output) { out_stream.read }
|
26
26
|
let(:config) { project_fixture_config }
|
27
|
-
let(:
|
27
|
+
let(:cli_class) { described_class }
|
28
28
|
let(:options) { { :environment => config.env } }
|
29
29
|
let(:gem_path) { Bundler::CLI::Common.select_spec("appsignal").full_gem_path.strip }
|
30
30
|
let(:received_report) { DiagnosticsReportEndpoint.received_report }
|
@@ -34,11 +34,11 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
34
34
|
before do
|
35
35
|
# Clear previous reports
|
36
36
|
DiagnosticsReportEndpoint.clear_report!
|
37
|
-
if
|
37
|
+
if cli_class.instance_variable_defined? :@data
|
38
38
|
# Because this is saved on the class rather than an instance of the
|
39
39
|
# class we need to clear it like this in case a certain test doesn't
|
40
40
|
# generate a report.
|
41
|
-
|
41
|
+
cli_class.send :remove_instance_variable, :@data
|
42
42
|
end
|
43
43
|
|
44
44
|
if DependencyHelper.rails_present?
|
@@ -54,16 +54,18 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
54
54
|
before :api_stub => true do
|
55
55
|
stub_api_request config, "auth"
|
56
56
|
end
|
57
|
+
before(:color => false) { options["no-color"] = nil }
|
58
|
+
before(:color => true) { options["color"] = nil }
|
57
59
|
before(:send_report => :yes_cli_input) do
|
58
60
|
accept_prompt_to_send_diagnostics_report
|
59
61
|
capture_diagnatics_report_request
|
60
62
|
end
|
61
63
|
before(:send_report => :no_cli_input) { dont_accept_prompt_to_send_diagnostics_report }
|
62
64
|
before(:send_report => :yes_cli_option) do
|
63
|
-
options[
|
65
|
+
options["send-report"] = nil
|
64
66
|
capture_diagnatics_report_request
|
65
67
|
end
|
66
|
-
before(:send_report => :no_cli_option) { options[
|
68
|
+
before(:send_report => :no_cli_option) { options["no-send-report"] = nil }
|
67
69
|
after { Appsignal.config = nil }
|
68
70
|
|
69
71
|
def capture_diagnatics_report_request
|
@@ -77,7 +79,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
77
79
|
def run_within_dir(chdir)
|
78
80
|
prepare_cli_input
|
79
81
|
Dir.chdir chdir do
|
80
|
-
capture_stdout(out_stream) {
|
82
|
+
capture_stdout(out_stream) { run_cli("diagnose", options) }
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
@@ -228,6 +230,14 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
228
230
|
|
229
231
|
it "outputs extension is not loaded" do
|
230
232
|
expect(output).to include "Extension loaded: false"
|
233
|
+
expect(output).to include "Extension is not loaded. No agent report created."
|
234
|
+
end
|
235
|
+
|
236
|
+
context "with color", :color => true do
|
237
|
+
it "outputs extension is not loaded in color" do
|
238
|
+
expect(output).to have_colorized_text :red,
|
239
|
+
" Extension is not loaded. No agent report created."
|
240
|
+
end
|
231
241
|
end
|
232
242
|
|
233
243
|
it "transmits extension_loaded: false in report" do
|
@@ -682,6 +692,12 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
682
692
|
context "without environment" do
|
683
693
|
let(:config) { project_fixture_config(nil) }
|
684
694
|
let(:options) { {} }
|
695
|
+
let(:warning_message) do
|
696
|
+
" Warning: No environment set, no config loaded!\n" \
|
697
|
+
" Please make sure appsignal diagnose is run within your\n" \
|
698
|
+
" project directory with an environment.\n" \
|
699
|
+
" appsignal diagnose --environment=production"
|
700
|
+
end
|
685
701
|
before do
|
686
702
|
ENV.delete("RAILS_ENV") # From spec_helper
|
687
703
|
ENV.delete("RACK_ENV")
|
@@ -689,10 +705,15 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
689
705
|
end
|
690
706
|
|
691
707
|
it "outputs a warning that no config is loaded" do
|
692
|
-
expect(output).to include \
|
693
|
-
|
694
|
-
|
695
|
-
|
708
|
+
expect(output).to include "Environment: \"\"\n#{warning_message}"
|
709
|
+
expect(output).to_not have_color_markers
|
710
|
+
end
|
711
|
+
|
712
|
+
context "with color", :color => true do
|
713
|
+
it "outputs a warning that no config is loaded in color" do
|
714
|
+
expect(output).to include "Environment: \"\"\n"
|
715
|
+
expect(output).to have_colorized_text :red, warning_message
|
716
|
+
end
|
696
717
|
end
|
697
718
|
|
698
719
|
it "outputs config defaults" do
|
@@ -890,6 +911,13 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
890
911
|
"Validating Push API key: valid"
|
891
912
|
end
|
892
913
|
|
914
|
+
context "with color", :color => true do
|
915
|
+
it "outputs valid in color" do
|
916
|
+
expect(output).to include "Validation",
|
917
|
+
"Validating Push API key: #{colorize("valid", :green)}"
|
918
|
+
end
|
919
|
+
end
|
920
|
+
|
893
921
|
it "transmits validation in report" do
|
894
922
|
expect(received_report).to include(
|
895
923
|
"validation" => {
|
@@ -910,6 +938,13 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
910
938
|
"Validating Push API key: invalid"
|
911
939
|
end
|
912
940
|
|
941
|
+
context "with color", :color => true do
|
942
|
+
it "outputs invalid in color" do
|
943
|
+
expect(output).to include "Validation",
|
944
|
+
"Validating Push API key: #{colorize("invalid", :red)}"
|
945
|
+
end
|
946
|
+
end
|
947
|
+
|
913
948
|
it "transmits validation in report" do
|
914
949
|
expect(received_report).to include(
|
915
950
|
"validation" => {
|
@@ -931,6 +966,14 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
931
966
|
%("Could not confirm authorization: 500")
|
932
967
|
end
|
933
968
|
|
969
|
+
context "with color", :color => true do
|
970
|
+
it "outputs error in color" do
|
971
|
+
expect(output).to include "Validation",
|
972
|
+
"Validating Push API key: " +
|
973
|
+
colorize(%(Failed with status 500\n"Could not confirm authorization: 500"), :red)
|
974
|
+
end
|
975
|
+
end
|
976
|
+
|
934
977
|
it "transmits validation in report" do
|
935
978
|
expect(received_report).to include(
|
936
979
|
"validation" => {
|
@@ -24,7 +24,7 @@ describe Appsignal::CLI::Helpers do
|
|
24
24
|
describe ".colorize" do
|
25
25
|
subject { cli.send(:colorize, "text", :green) }
|
26
26
|
|
27
|
-
context "on windows" do
|
27
|
+
context "when on windows" do
|
28
28
|
before { allow(Gem).to receive(:win_platform?).and_return(true) }
|
29
29
|
|
30
30
|
it "outputs plain string" do
|
@@ -32,11 +32,19 @@ describe Appsignal::CLI::Helpers do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
context "
|
35
|
+
context "when coloring is set to false" do
|
36
|
+
before { cli.send(:coloring=, false) }
|
37
|
+
|
38
|
+
it "outputs plain string" do
|
39
|
+
expect(subject).to eq "text"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "when not on windows" do
|
36
44
|
before { allow(Gem).to receive(:win_platform?).and_return(false) }
|
37
45
|
|
38
46
|
it "wraps text in color tags" do
|
39
|
-
expect(subject).to
|
47
|
+
expect(subject).to have_colorized_text(:green, "text")
|
40
48
|
end
|
41
49
|
end
|
42
50
|
end
|
@@ -9,6 +9,7 @@ describe Appsignal::CLI::Install do
|
|
9
9
|
let(:config) { Appsignal::Config.new(tmp_dir, "") }
|
10
10
|
let(:config_file_path) { File.join(tmp_dir, "config", "appsignal.yml") }
|
11
11
|
let(:config_file) { File.read(config_file_path) }
|
12
|
+
let(:options) { {} }
|
12
13
|
before do
|
13
14
|
stub_api_validation_request
|
14
15
|
# Stub calls to speed up tests
|
@@ -91,7 +92,7 @@ describe Appsignal::CLI::Install do
|
|
91
92
|
Dir.chdir tmp_dir do
|
92
93
|
prepare_cli_input
|
93
94
|
capture_stdout(out_stream) do
|
94
|
-
run_cli(["install", push_api_key])
|
95
|
+
run_cli(["install", push_api_key], options)
|
95
96
|
end
|
96
97
|
end
|
97
98
|
end
|
@@ -667,6 +668,34 @@ describe Appsignal::CLI::Install do
|
|
667
668
|
it_behaves_like "push_api_key validation"
|
668
669
|
it_behaves_like "demo data"
|
669
670
|
|
671
|
+
context "without color options" do
|
672
|
+
let(:options) { {} }
|
673
|
+
|
674
|
+
it "prints the instructions in color" do
|
675
|
+
run
|
676
|
+
expect(output).to have_colorized_text(:green, "## Starting AppSignal Installer ##")
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
context "with --color option" do
|
681
|
+
let(:options) { { "color" => nil } }
|
682
|
+
|
683
|
+
it "prints the instructions in color" do
|
684
|
+
run
|
685
|
+
expect(output).to have_colorized_text(:green, "## Starting AppSignal Installer ##")
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
context "with --no-color option" do
|
690
|
+
let(:options) { { "no-color" => nil } }
|
691
|
+
|
692
|
+
it "prints the instructions without special colors" do
|
693
|
+
run
|
694
|
+
expect(output).to include("Starting AppSignal Installer")
|
695
|
+
expect(output).to_not have_color_markers
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
670
699
|
it "prints a message about unknown framework" do
|
671
700
|
run
|
672
701
|
|
@@ -5,6 +5,8 @@ describe Appsignal::CLI::NotifyOfDeploy do
|
|
5
5
|
|
6
6
|
let(:out_stream) { std_stream }
|
7
7
|
let(:output) { out_stream.read }
|
8
|
+
let(:err_stream) { std_stream }
|
9
|
+
let(:stderr) { err_stream.read }
|
8
10
|
|
9
11
|
define :include_deploy_notification do
|
10
12
|
match do |log|
|
@@ -32,7 +34,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def run
|
35
|
-
|
37
|
+
capture_std_streams(out_stream, err_stream) do
|
36
38
|
run_cli("notify_of_deploy", options)
|
37
39
|
end
|
38
40
|
end
|
@@ -130,7 +132,7 @@ describe Appsignal::CLI::NotifyOfDeploy do
|
|
130
132
|
it "prints a deprecation message" do
|
131
133
|
run
|
132
134
|
deprecation_message = "This command (appsignal notify_of_deploy) has been deprecated"
|
133
|
-
expect(
|
135
|
+
expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
|
134
136
|
expect(log).to contains_log :warn, deprecation_message
|
135
137
|
end
|
136
138
|
|
@@ -47,15 +47,43 @@ describe Appsignal::Config do
|
|
47
47
|
subject { config[:active] }
|
48
48
|
|
49
49
|
context "with APPSIGNAL_PUSH_API_KEY env variable" do
|
50
|
-
|
50
|
+
context "when not empty" do
|
51
|
+
before { ENV["APPSIGNAL_PUSH_API_KEY"] = "abc" }
|
51
52
|
|
52
|
-
|
53
|
-
|
53
|
+
it "becomes active" do
|
54
|
+
expect(subject).to be_truthy
|
55
|
+
end
|
56
|
+
|
57
|
+
it "sets the push_api_key as loaded through the env_config" do
|
58
|
+
expect(config.env_config).to eq(:push_api_key => "abc")
|
59
|
+
expect(config.system_config).to eq(:active => true)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "when empty string" do
|
64
|
+
before { ENV["APPSIGNAL_PUSH_API_KEY"] = "" }
|
65
|
+
|
66
|
+
it "does not becomes active" do
|
67
|
+
expect(subject).to be_falsy
|
68
|
+
end
|
69
|
+
|
70
|
+
it "sets the push_api_key as loaded through the env_config" do
|
71
|
+
expect(config.env_config).to eq(:push_api_key => "")
|
72
|
+
expect(config.system_config).to be_empty
|
73
|
+
end
|
54
74
|
end
|
55
75
|
|
56
|
-
|
57
|
-
|
58
|
-
|
76
|
+
context "when blank string" do
|
77
|
+
before { ENV["APPSIGNAL_PUSH_API_KEY"] = " " }
|
78
|
+
|
79
|
+
it "does not becomes active" do
|
80
|
+
expect(subject).to be_falsy
|
81
|
+
end
|
82
|
+
|
83
|
+
it "sets the push_api_key as loaded through the env_config" do
|
84
|
+
expect(config.env_config).to eq(:push_api_key => " ")
|
85
|
+
expect(config.system_config).to be_empty
|
86
|
+
end
|
59
87
|
end
|
60
88
|
end
|
61
89
|
|
@@ -134,6 +162,7 @@ describe Appsignal::Config do
|
|
134
162
|
:ca_file_path => File.join(resources_dir, "cacert.pem"),
|
135
163
|
:dns_servers => [],
|
136
164
|
:files_world_accessible => true,
|
165
|
+
:transaction_debug_mode => false,
|
137
166
|
:revision => "v2.5.1",
|
138
167
|
:request_headers => []
|
139
168
|
)
|
@@ -214,6 +243,30 @@ describe Appsignal::Config do
|
|
214
243
|
end
|
215
244
|
end
|
216
245
|
|
246
|
+
context "with the config file causing an error" do
|
247
|
+
let(:config_path) do
|
248
|
+
File.expand_path(
|
249
|
+
File.join(File.dirname(__FILE__), "../../support/fixtures/projects/broken")
|
250
|
+
)
|
251
|
+
end
|
252
|
+
let(:config) { Appsignal::Config.new(config_path, "foo") }
|
253
|
+
|
254
|
+
it "logs & prints an error, skipping the file source" do
|
255
|
+
stdout = std_stream
|
256
|
+
stderr = std_stream
|
257
|
+
log = capture_logs { capture_std_streams(stdout, stderr) { config } }
|
258
|
+
message = "An error occured while loading the AppSignal config file. " \
|
259
|
+
"Skipping file config.\n" \
|
260
|
+
"File: #{File.join(config_path, "config", "appsignal.yml").inspect}\n" \
|
261
|
+
"KeyError: key not found"
|
262
|
+
expect(log).to contains_log :error, message
|
263
|
+
expect(log).to include("/appsignal/config.rb:") # Backtrace
|
264
|
+
expect(stdout.read).to_not include("appsignal:")
|
265
|
+
expect(stderr.read).to include "appsignal: #{message}"
|
266
|
+
expect(config.file_config).to eql({})
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
217
270
|
it "sets the file_config" do
|
218
271
|
# config found in spec/support/project_fixture/config/appsignal.yml
|
219
272
|
expect(config.file_config).to match(
|
@@ -264,17 +317,17 @@ describe Appsignal::Config do
|
|
264
317
|
expect_any_instance_of(Logger).to receive(:error).once
|
265
318
|
.with("Not loading from config file: config for 'nonsense' not found")
|
266
319
|
expect_any_instance_of(Logger).to receive(:error).once
|
267
|
-
.with("Push
|
320
|
+
.with("Push API key not set after loading config")
|
268
321
|
config
|
269
322
|
end
|
270
323
|
end
|
271
324
|
|
272
325
|
describe "support for old config keys" do
|
273
|
-
let(:
|
274
|
-
let(:
|
326
|
+
let(:err_stream) { std_stream }
|
327
|
+
let(:stderr) { err_stream.read }
|
275
328
|
let(:config) { project_fixture_config(env, {}, test_logger(log)) }
|
276
329
|
let(:log) { StringIO.new }
|
277
|
-
before {
|
330
|
+
before { capture_std_streams(std_stream, err_stream) { config } }
|
278
331
|
|
279
332
|
describe ":api_key" do
|
280
333
|
context "without :push_api_key" do
|
@@ -285,7 +338,7 @@ describe Appsignal::Config do
|
|
285
338
|
expect(config.config_hash).to_not have_key :api_key
|
286
339
|
|
287
340
|
message = "Old configuration key found. Please update the 'api_key' to 'push_api_key'"
|
288
|
-
expect(
|
341
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
289
342
|
expect(log_contents(log)).to contains_log :warn, message
|
290
343
|
end
|
291
344
|
end
|
@@ -298,7 +351,7 @@ describe Appsignal::Config do
|
|
298
351
|
expect(config.config_hash).to_not have_key :api_key
|
299
352
|
|
300
353
|
message = "Old configuration key found. Please update the 'api_key' to 'push_api_key'"
|
301
|
-
expect(
|
354
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
302
355
|
expect(log_contents(log)).to contains_log :warn, message
|
303
356
|
end
|
304
357
|
end
|
@@ -313,7 +366,7 @@ describe Appsignal::Config do
|
|
313
366
|
expect(config.config_hash).to_not have_key :ignore_exceptions
|
314
367
|
|
315
368
|
message = "Old configuration key found. Please update the 'ignore_exceptions' to 'ignore_errors'"
|
316
|
-
expect(
|
369
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
317
370
|
expect(log_contents(log)).to contains_log :warn, message
|
318
371
|
end
|
319
372
|
end
|
@@ -326,7 +379,7 @@ describe Appsignal::Config do
|
|
326
379
|
expect(config.config_hash).to_not have_key :ignore_exceptions
|
327
380
|
|
328
381
|
message = "Old configuration key found. Please update the 'ignore_exceptions' to 'ignore_errors'"
|
329
|
-
expect(
|
382
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
330
383
|
expect(log_contents(log)).to contains_log :warn, message
|
331
384
|
end
|
332
385
|
end
|
@@ -473,6 +526,7 @@ describe Appsignal::Config do
|
|
473
526
|
config[:filter_parameters] = %w[password confirm_password]
|
474
527
|
config[:running_in_container] = false
|
475
528
|
config[:dns_servers] = ["8.8.8.8", "8.8.4.4"]
|
529
|
+
config[:transaction_debug_mode] = true
|
476
530
|
config[:revision] = "v2.5.1"
|
477
531
|
config.write_to_environment
|
478
532
|
end
|
@@ -500,6 +554,7 @@ describe Appsignal::Config do
|
|
500
554
|
expect(ENV["_APPSIGNAL_CA_FILE_PATH"]).to eq File.join(resources_dir, "cacert.pem")
|
501
555
|
expect(ENV["_APPSIGNAL_DNS_SERVERS"]).to eq "8.8.8.8,8.8.4.4"
|
502
556
|
expect(ENV["_APPSIGNAL_FILES_WORLD_ACCESSIBLE"]).to eq "true"
|
557
|
+
expect(ENV["_APPSIGNAL_TRANSACTION_DEBUG_MODE"]).to eq "true"
|
503
558
|
expect(ENV["_APP_REVISION"]).to eq "v2.5.1"
|
504
559
|
expect(ENV).to_not have_key("_APPSIGNAL_WORKING_DIR_PATH")
|
505
560
|
expect(ENV).to_not have_key("_APPSIGNAL_WORKING_DIRECTORY_PATH")
|
@@ -721,6 +776,22 @@ describe Appsignal::Config do
|
|
721
776
|
end
|
722
777
|
end
|
723
778
|
|
779
|
+
context "with empty push_api_key" do
|
780
|
+
let(:push_api_key) { "" }
|
781
|
+
|
782
|
+
it "sets valid to false" do
|
783
|
+
is_expected.to eq(false)
|
784
|
+
end
|
785
|
+
end
|
786
|
+
|
787
|
+
context "with blank push_api_key" do
|
788
|
+
let(:push_api_key) { " " }
|
789
|
+
|
790
|
+
it "sets valid to false" do
|
791
|
+
is_expected.to eq(false)
|
792
|
+
end
|
793
|
+
end
|
794
|
+
|
724
795
|
context "with push_api_key present" do
|
725
796
|
let(:push_api_key) { "abc" }
|
726
797
|
|
@@ -116,7 +116,8 @@ describe Appsignal::EventFormatter do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
context "when registering deprecated formatters" do
|
119
|
-
let(:
|
119
|
+
let(:err_stream) { std_stream }
|
120
|
+
let(:stderr) { err_stream.read }
|
120
121
|
let(:deprecated_formatter) do
|
121
122
|
Class.new(Appsignal::EventFormatter) do
|
122
123
|
register "mock.deprecated"
|
@@ -133,16 +134,16 @@ describe Appsignal::EventFormatter do
|
|
133
134
|
"https://docs.appsignal.com/ruby/instrumentation/event-formatters.html"
|
134
135
|
|
135
136
|
logs = capture_logs do
|
136
|
-
|
137
|
+
capture_std_streams(std_stream, err_stream) { deprecated_formatter }
|
137
138
|
end
|
138
139
|
expect(logs).to contains_log :warn, message
|
139
|
-
expect(
|
140
|
+
expect(stderr).to include "appsignal WARNING: #{message}"
|
140
141
|
|
141
142
|
expect(klass.deprecated_formatter_classes.keys).to include("mock.deprecated")
|
142
143
|
end
|
143
144
|
|
144
145
|
it "initializes deprecated formatters" do
|
145
|
-
|
146
|
+
capture_std_streams(std_stream, err_stream) { deprecated_formatter }
|
146
147
|
klass.initialize_deprecated_formatters
|
147
148
|
|
148
149
|
expect(klass.registered?("mock.deprecated")).to be_truthy
|