appsignal 2.9.18-java → 2.10.0-java
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/CHANGELOG.md +17 -1
- data/Rakefile +16 -2
- data/lib/appsignal/cli.rb +9 -2
- data/lib/appsignal/cli/diagnose.rb +20 -19
- data/lib/appsignal/cli/helpers.rb +22 -10
- data/lib/appsignal/cli/install.rb +2 -1
- data/lib/appsignal/config.rb +18 -7
- data/lib/appsignal/event_formatter.rb +4 -4
- data/lib/appsignal/minutely.rb +4 -4
- data/lib/appsignal/rack/js_exception_catcher.rb +6 -0
- data/lib/appsignal/transaction.rb +1 -1
- data/lib/appsignal/version.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/config_spec.rb +75 -7
- 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/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/minutely_spec.rb +3 -3
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +19 -5
- data/spec/lib/appsignal/transaction_spec.rb +4 -12
- data/spec/lib/appsignal_spec.rb +7 -8
- data/spec/spec_helper.rb +11 -11
- data/spec/support/fixtures/projects/broken/config/appsignal.yml +1 -0
- data/spec/support/helpers/cli_helpers.rb +15 -1
- data/spec/support/helpers/transaction_helpers.rb +53 -0
- 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
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dad61f29ac406162e596243322f25b61b71f4c89824ea15339d809bc1f2eff7
|
4
|
+
data.tar.gz: 6a313f7d4502f6b68539207168d54d8ff525ceb4c79b1b7fe7f1b52b6ba57403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1df6bcedb0812080ccc0ada7386b9421b115556e9ebd266b7b4e27f5c70f4f2d33706faacc2e354dc965a1bbb07e7398a638f7686a2c16fafcb3a733bf498bf
|
7
|
+
data.tar.gz: ce2f3064a2e8c1361253283a20f29adddea75b49c308fc0f72951c424b20a876cb0d89e172d2a82a7c1ea8a7983c58553d5f8aed8fa59119f1bd42406fbed8ec
|
data/.rubocop_todo.yml
CHANGED
@@ -89,12 +89,6 @@ Style/ClassAndModuleChildren:
|
|
89
89
|
Exclude:
|
90
90
|
- 'lib/appsignal/integrations/padrino.rb'
|
91
91
|
|
92
|
-
# Offense count: 6
|
93
|
-
Style/ClassVars:
|
94
|
-
Exclude:
|
95
|
-
- 'lib/appsignal/event_formatter.rb'
|
96
|
-
- 'lib/appsignal/minutely.rb'
|
97
|
-
|
98
92
|
# Offense count: 1
|
99
93
|
Style/DoubleNegation:
|
100
94
|
Exclude:
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 2.
|
3
|
+
## 2.10.0
|
4
|
+
- Rescue errors while parsing `appsignal.yml` file. It will prints a warning
|
5
|
+
instead. PR #517
|
6
|
+
- Refactoring: Reduce class variable usage. PR #520
|
7
|
+
- Bump log level about starting new transactions while a transaction is already
|
8
|
+
active from debug to a warning. PR #525
|
9
|
+
- Refactoring: Add internal AppSignal test helpers and other test suite
|
10
|
+
refactorings. PR #536, #537, #538, #539
|
11
|
+
- Fix internal Rakefile loading on Ruby 1.9.3. PR #541
|
12
|
+
- Add a `--no-color` option to the `appsignal install` command. PR #550
|
13
|
+
- Add output coloring to `appsignal diagnose` warnings. PR #551
|
14
|
+
- Add validation for empty Push API key. Empty Push API key values will no
|
15
|
+
longer start AppSignal. PR #569
|
16
|
+
- Deprecate the JSExceptionCatcher middleware in favor of our new front-end
|
17
|
+
JavaScript integration (https://docs.appsignal.com/front-end/). PR #572
|
18
|
+
|
19
|
+
## 2.9.18
|
4
20
|
- Bump agent to v-c348132
|
5
21
|
- Improve transmitter logging on timeout
|
6
22
|
- Improve queued payloads transmitter. Should prevent payloads being sent
|
data/Rakefile
CHANGED
@@ -143,9 +143,23 @@ namespace :build do
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
+
def define_build_task(task_name, base_gemspec, &block)
|
147
|
+
Gem::PackageTask.new(base_gemspec, &block)
|
148
|
+
rescue StandardError => error
|
149
|
+
puts "Warning: An error occurred defining `build:#{task_name}:gem` Rake task."
|
150
|
+
puts "This task will not be availble."
|
151
|
+
if ENV["DEBUG"]
|
152
|
+
puts "#{error}: #{error.message}"
|
153
|
+
puts error.backtrace
|
154
|
+
else
|
155
|
+
puts "For more information, run the same command with `DEBUG=true`."
|
156
|
+
end
|
157
|
+
puts
|
158
|
+
end
|
159
|
+
|
146
160
|
namespace :ruby do
|
147
161
|
# Extension default set in `appsignal.gemspec`
|
148
|
-
|
162
|
+
define_build_task(:ruby, base_gemspec) { |_pkg| }
|
149
163
|
end
|
150
164
|
|
151
165
|
namespace :jruby do
|
@@ -157,7 +171,7 @@ namespace :build do
|
|
157
171
|
s.add_dependency "ffi"
|
158
172
|
end
|
159
173
|
|
160
|
-
|
174
|
+
define_build_task(:jruby, spec) { |_pkg| }
|
161
175
|
end
|
162
176
|
|
163
177
|
desc "Build all gem versions"
|
data/lib/appsignal/cli.rb
CHANGED
@@ -32,7 +32,7 @@ module Appsignal
|
|
32
32
|
when :diagnose
|
33
33
|
Appsignal::CLI::Diagnose.run(options)
|
34
34
|
when :install
|
35
|
-
Appsignal::CLI::Install.run(argv.shift)
|
35
|
+
Appsignal::CLI::Install.run(argv.shift, options)
|
36
36
|
when :notify_of_deploy
|
37
37
|
Appsignal::CLI::NotifyOfDeploy.run(options)
|
38
38
|
end
|
@@ -85,8 +85,15 @@ module Appsignal
|
|
85
85
|
o.on "--[no-]send-report", "Confirm sending the report to AppSignal automatically" do |arg|
|
86
86
|
options[:send_report] = arg
|
87
87
|
end
|
88
|
+
o.on "--[no-]color", "Colorize the output of the diagnose command" do |arg|
|
89
|
+
options[:color] = arg
|
90
|
+
end
|
91
|
+
end,
|
92
|
+
"install" => OptionParser.new do |o|
|
93
|
+
o.on "--[no-]color", "Colorize the output of the diagnose command" do |arg|
|
94
|
+
options[:color] = arg
|
95
|
+
end
|
88
96
|
end,
|
89
|
-
"install" => OptionParser.new,
|
90
97
|
"notify_of_deploy" => OptionParser.new do |o|
|
91
98
|
o.banner = "Usage: appsignal notify_of_deploy [options]"
|
92
99
|
|
@@ -77,6 +77,7 @@ module Appsignal
|
|
77
77
|
# @return [void]
|
78
78
|
# @api private
|
79
79
|
def run(options = {})
|
80
|
+
self.coloring = options.delete(:color) { true }
|
80
81
|
$stdout.sync = true
|
81
82
|
header
|
82
83
|
print_empty_line
|
@@ -200,7 +201,7 @@ module Appsignal
|
|
200
201
|
def run_agent_diagnose_mode
|
201
202
|
puts "Agent diagnostics"
|
202
203
|
unless Appsignal.extension_loaded?
|
203
|
-
puts " Extension is not loaded. No agent report created."
|
204
|
+
puts colorize(" Extension is not loaded. No agent report created.", :red)
|
204
205
|
return
|
205
206
|
end
|
206
207
|
|
@@ -461,10 +462,11 @@ module Appsignal
|
|
461
462
|
print " Environment: #{format_config_option(env)}"
|
462
463
|
|
463
464
|
if env == ""
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
465
|
+
message = " Warning: No environment set, no config loaded!\n" \
|
466
|
+
" Please make sure appsignal diagnose is run within your\n" \
|
467
|
+
" project directory with an environment.\n" \
|
468
|
+
" appsignal diagnose --environment=production"
|
469
|
+
puts "\n#{colorize(message, :red)}"
|
468
470
|
else
|
469
471
|
puts sources_label
|
470
472
|
end
|
@@ -531,20 +533,19 @@ module Appsignal
|
|
531
533
|
|
532
534
|
def check_api_key
|
533
535
|
puts "Validation"
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
end
|
536
|
+
auth_check = ::Appsignal::AuthCheck.new(Appsignal.config)
|
537
|
+
status, error = auth_check.perform_with_result
|
538
|
+
result, color =
|
539
|
+
case status
|
540
|
+
when "200"
|
541
|
+
["valid", :green]
|
542
|
+
when "401"
|
543
|
+
["invalid", :red]
|
544
|
+
else
|
545
|
+
["Failed with status #{status}\n#{error.inspect}", :red]
|
546
|
+
end
|
547
|
+
data[:validation][:push_api_key] = result
|
548
|
+
puts_value "Validating Push API key", colorize(result, color)
|
548
549
|
end
|
549
550
|
|
550
551
|
def print_paths_section(report)
|
@@ -7,24 +7,36 @@ module Appsignal
|
|
7
7
|
module Helpers
|
8
8
|
private
|
9
9
|
|
10
|
+
COLOR_CODES = {
|
11
|
+
:red => 31,
|
12
|
+
:green => 32,
|
13
|
+
:yellow => 33,
|
14
|
+
:blue => 34,
|
15
|
+
:pink => 35,
|
16
|
+
:default => 0
|
17
|
+
}.freeze
|
18
|
+
|
10
19
|
def ruby_2_6_or_up?
|
11
20
|
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
|
12
21
|
end
|
13
22
|
|
23
|
+
def coloring=(value)
|
24
|
+
@coloring = value
|
25
|
+
end
|
26
|
+
|
27
|
+
def coloring?
|
28
|
+
return true unless defined?(@coloring)
|
29
|
+
@coloring
|
30
|
+
end
|
31
|
+
|
14
32
|
def colorize(text, color)
|
33
|
+
return text unless coloring?
|
15
34
|
return text if Gem.win_platform?
|
16
35
|
|
17
|
-
|
18
|
-
|
19
|
-
when :red then 31
|
20
|
-
when :green then 32
|
21
|
-
when :yellow then 33
|
22
|
-
when :blue then 34
|
23
|
-
when :pink then 35
|
24
|
-
else 0
|
25
|
-
end
|
36
|
+
reset_color_code = COLOR_CODES.fetch(:default)
|
37
|
+
color_code = COLOR_CODES.fetch(color, reset_color_code)
|
26
38
|
|
27
|
-
"\e[#{color_code}m#{text}\e[
|
39
|
+
"\e[#{color_code}m#{text}\e[#{reset_color_code}m"
|
28
40
|
end
|
29
41
|
|
30
42
|
def periods
|
data/lib/appsignal/config.rb
CHANGED
@@ -237,11 +237,12 @@ module Appsignal
|
|
237
237
|
"#{endpoint_uri.scheme}://#{endpoint_uri.host}:#{endpoint_uri.port}"
|
238
238
|
end
|
239
239
|
|
240
|
-
|
241
|
-
|
242
|
-
else
|
240
|
+
push_api_key = config_hash[:push_api_key] || ""
|
241
|
+
if push_api_key.strip.empty?
|
243
242
|
@valid = false
|
244
|
-
@logger.error "Push
|
243
|
+
@logger.error "Push API key not set after loading config"
|
244
|
+
else
|
245
|
+
@valid = true
|
245
246
|
end
|
246
247
|
end
|
247
248
|
|
@@ -256,8 +257,10 @@ module Appsignal
|
|
256
257
|
{}.tap do |hash|
|
257
258
|
hash[:log] = "stdout" if Appsignal::System.heroku?
|
258
259
|
|
259
|
-
# Make active by default if APPSIGNAL_PUSH_API_KEY
|
260
|
-
|
260
|
+
# Make AppSignal active by default if APPSIGNAL_PUSH_API_KEY
|
261
|
+
# environment variable is present and not empty.
|
262
|
+
env_push_api_key = ENV["APPSIGNAL_PUSH_API_KEY"] || ""
|
263
|
+
hash[:active] = true unless env_push_api_key.strip.empty?
|
261
264
|
end
|
262
265
|
end
|
263
266
|
|
@@ -274,9 +277,17 @@ module Appsignal
|
|
274
277
|
|
275
278
|
maintain_backwards_compatibility(config_for_this_env)
|
276
279
|
else
|
277
|
-
|
280
|
+
logger.error "Not loading from config file: config for '#{env}' not found"
|
278
281
|
nil
|
279
282
|
end
|
283
|
+
rescue => e
|
284
|
+
message = "An error occured while loading the AppSignal config file." \
|
285
|
+
" Skipping file config.\n" \
|
286
|
+
"File: #{config_file.inspect}\n" \
|
287
|
+
"#{e.name}: #{e}"
|
288
|
+
$stderr.puts "appsignal: #{message}"
|
289
|
+
logger.error "#{message}\n#{e.backtrace.join("\n")}"
|
290
|
+
nil
|
280
291
|
end
|
281
292
|
|
282
293
|
# Maintain backwards compatibility with config files generated by earlier
|
@@ -17,15 +17,15 @@ module Appsignal
|
|
17
17
|
include Appsignal::Utils::DeprecationMessage
|
18
18
|
|
19
19
|
def formatters
|
20
|
-
|
20
|
+
@formatters ||= {}
|
21
21
|
end
|
22
22
|
|
23
23
|
def deprecated_formatter_classes
|
24
|
-
|
24
|
+
@deprecated_formatter_classes ||= {}
|
25
25
|
end
|
26
26
|
|
27
27
|
def formatter_classes
|
28
|
-
|
28
|
+
@formatter_classes ||= {}
|
29
29
|
end
|
30
30
|
|
31
31
|
def register(name, formatter = nil)
|
@@ -94,7 +94,7 @@ module Appsignal
|
|
94
94
|
"https://docs.appsignal.com/ruby/instrumentation/event-formatters.html",
|
95
95
|
logger
|
96
96
|
|
97
|
-
deprecated_formatter_classes[name] = self
|
97
|
+
EventFormatter.deprecated_formatter_classes[name] = self
|
98
98
|
end
|
99
99
|
|
100
100
|
def logger
|
data/lib/appsignal/minutely.rb
CHANGED
@@ -129,13 +129,13 @@ module Appsignal
|
|
129
129
|
# @see ProbeCollection
|
130
130
|
# @return [ProbeCollection] Returns list of probes.
|
131
131
|
def probes
|
132
|
-
|
132
|
+
@probes ||= ProbeCollection.new
|
133
133
|
end
|
134
134
|
|
135
135
|
# @api private
|
136
136
|
def start
|
137
137
|
stop
|
138
|
-
|
138
|
+
@thread = Thread.new do
|
139
139
|
sleep initial_wait_time
|
140
140
|
initialize_probes
|
141
141
|
loop do
|
@@ -157,7 +157,7 @@ module Appsignal
|
|
157
157
|
|
158
158
|
# @api private
|
159
159
|
def stop
|
160
|
-
defined?(
|
160
|
+
defined?(@thread) && @thread.kill
|
161
161
|
probe_instances.clear
|
162
162
|
end
|
163
163
|
|
@@ -206,7 +206,7 @@ module Appsignal
|
|
206
206
|
end
|
207
207
|
|
208
208
|
def probe_instances
|
209
|
-
|
209
|
+
@probe_instances ||= {}
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
@@ -23,9 +23,15 @@ module Appsignal
|
|
23
23
|
# @see http://docs.appsignal.com/front-end/error-handling.html
|
24
24
|
# @api private
|
25
25
|
class JSExceptionCatcher
|
26
|
+
include Appsignal::Utils::DeprecationMessage
|
27
|
+
|
26
28
|
def initialize(app, _options = nil)
|
27
29
|
Appsignal.logger.debug \
|
28
30
|
"Initializing Appsignal::Rack::JSExceptionCatcher"
|
31
|
+
message = "The Appsignal::Rack::JSExceptionCatcher is deprecated. " \
|
32
|
+
"Please use the official AppSignal JavaScript integration instead. " \
|
33
|
+
"https://docs.appsignal.com/front-end/"
|
34
|
+
deprecation_message message, Appsignal.logger
|
29
35
|
@app = app
|
30
36
|
end
|
31
37
|
|
@@ -25,7 +25,7 @@ module Appsignal
|
|
25
25
|
Thread.current[:appsignal_transaction] = Appsignal::Transaction.new(id, namespace, request, options)
|
26
26
|
else
|
27
27
|
# Otherwise, log the issue about trying to start another transaction
|
28
|
-
Appsignal.logger.
|
28
|
+
Appsignal.logger.warn "Trying to start new transaction with id " \
|
29
29
|
"'#{id}', but a transaction with id '#{current.transaction_id}' " \
|
30
30
|
"is already running. Using transaction '#{current.transaction_id}'."
|
31
31
|
|
data/lib/appsignal/version.rb
CHANGED
@@ -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.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" => {
|