appmap 0.66.0 → 0.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +39 -0
- data/ext/appmap/extconf.rb +11 -0
- data/lib/appmap/command/agent_setup/validate.rb +8 -1
- data/lib/appmap/command/inspect.rb +0 -1
- data/lib/appmap/config.rb +4 -3
- data/lib/appmap/depends/api.rb +1 -1
- data/lib/appmap/depends/configuration.rb +0 -2
- data/lib/appmap/depends/util.rb +1 -1
- data/lib/appmap/event.rb +4 -2
- data/lib/appmap/handler/net_http.rb +14 -12
- data/lib/appmap/handler/rails/request_handler.rb +4 -10
- data/lib/appmap/minitest.rb +1 -0
- data/lib/appmap/rspec.rb +1 -0
- data/lib/appmap/swagger/configuration.rb +2 -0
- data/lib/appmap/util.rb +12 -2
- data/lib/appmap/version.rb +1 -1
- data/lib/appmap.rb +2 -2
- data/spec/depends/api_spec.rb +3 -3
- data/spec/fixtures/config/missing_path_or_gem.yml +3 -0
- data/spec/rails_recording_spec.rb +1 -1
- data/spec/rails_spec_helper.rb +6 -1
- data/test/agent_setup_validate_test.rb +35 -8
- data/test/fixtures/mocha_mock_app/Gemfile +5 -0
- data/test/fixtures/mocha_mock_app/appmap.yml +5 -0
- data/test/fixtures/mocha_mock_app/lib/sheep.rb +5 -0
- data/test/fixtures/mocha_mock_app/test/sheep_test.rb +18 -0
- data/test/mock_compatibility_test.rb +45 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66a5dd9600679b05f4789e2531ca6151bc46fa5e95a7458d401f67b3b94861e7
|
4
|
+
data.tar.gz: 89380ec4d7ebfabe615a187a1d0a10ad107d06df4e5bc50c987b62a3f27c4edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b13f75e8fbe46e5ddf9a5ec817eaebfd0356d124f2a117e74c24a44d07a8d89f9b0e5afcacbe9ea1277f34979955f30d441c5325ce8aa954bfeda08ce2f03f
|
7
|
+
data.tar.gz: 27c0ba4946df49d998aa6cfa5cfae8cbcc10bed6ec0590ac06c106e99d828f03bfb675b4a67317b1abd1b87ba1c0016699f44470585c0954d431198ee34b6b44
|
data/.travis.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
language: ruby
|
2
|
+
dist: bionic
|
2
3
|
|
3
4
|
rbenv:
|
4
5
|
- 2.6
|
@@ -15,6 +16,7 @@ services:
|
|
15
16
|
- docker
|
16
17
|
|
17
18
|
before_install:
|
19
|
+
- sudo apt-get update && sudo apt-get install apt-transport-https ca-certificates -y && sudo update-ca-certificates
|
18
20
|
# see https://blog.travis-ci.com/docker-rate-limits
|
19
21
|
# and also https://www.docker.com/blog/what-you-need-to-know-about-upcoming-docker-hub-rate-limiting/
|
20
22
|
# if we do not use authorized account,
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,42 @@
|
|
1
|
+
## [0.67.1](https://github.com/applandinc/appmap-ruby/compare/v0.67.0...v0.67.1) (2021-11-02)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Don't try to index AppMaps when inspecting ([ca18861](https://github.com/applandinc/appmap-ruby/commit/ca188619bd7085caa75a06eeeb5d5a92213251ac))
|
7
|
+
|
8
|
+
# [0.67.0](https://github.com/applandinc/appmap-ruby/compare/v0.66.2...v0.67.0) (2021-10-21)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* Ensure rack is available, and handle nil HTTP response ([5e81dc4](https://github.com/applandinc/appmap-ruby/commit/5e81dc4310c9b7f2d81c31339f8490639c845f76))
|
14
|
+
* Handle WeakRef ([852ee04](https://github.com/applandinc/appmap-ruby/commit/852ee047880f9d1492be38772ed3f0cc1a670cb5))
|
15
|
+
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
* APPMAP_AUTOREQUIRE and APPMAP_INITIALIZE env vars to customize loading behavior ([369807e](https://github.com/applandinc/appmap-ruby/commit/369807e4c90243e296b324e70805bd09d0f5fc4a))
|
20
|
+
* Perform GC before running each test ([84c895e](https://github.com/applandinc/appmap-ruby/commit/84c895e95fe8caa270cc1412e239599bfcc1b467))
|
21
|
+
|
22
|
+
## [0.66.2](https://github.com/applandinc/appmap-ruby/compare/v0.66.1...v0.66.2) (2021-10-07)
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* fix Travis for Ruby 3.0 ([8ec7359](https://github.com/applandinc/appmap-ruby/commit/8ec7359287f5b204ae9fb0724d8b683adfb79df5))
|
28
|
+
* Fix warning of circular import ([84d456d](https://github.com/applandinc/appmap-ruby/commit/84d456d8ac26ef3fc7a81ca6517e4363aac9916d))
|
29
|
+
* Properly handle headers which aren't mangled by Rack ([8e78e13](https://github.com/applandinc/appmap-ruby/commit/8e78e138776cb563f984e3592cf5024af16da2b7))
|
30
|
+
* replace deprecated File.exists? method ([80ce5b5](https://github.com/applandinc/appmap-ruby/commit/80ce5b59fd010a806ca6320365f453f1e74f095d))
|
31
|
+
* Validate presence package configuration ([f478d6b](https://github.com/applandinc/appmap-ruby/commit/f478d6b60a786608c21217755cec9a8185e084d3))
|
32
|
+
|
33
|
+
## [0.66.1](https://github.com/applandinc/appmap-ruby/compare/v0.66.0...v0.66.1) (2021-09-29)
|
34
|
+
|
35
|
+
|
36
|
+
### Bug Fixes
|
37
|
+
|
38
|
+
* Fix compilation on macOS with Xcode 13 ([8c66e08](https://github.com/applandinc/appmap-ruby/commit/8c66e08393bf8d9efac9635ad7a150329797729d))
|
39
|
+
|
1
40
|
# [0.66.0](https://github.com/applandinc/appmap-ruby/compare/v0.65.1...v0.66.0) (2021-09-28)
|
2
41
|
|
3
42
|
|
data/ext/appmap/extconf.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
|
3
|
+
|
3
4
|
$CFLAGS='-Werror'
|
5
|
+
|
6
|
+
# Per https://bugs.ruby-lang.org/issues/17865,
|
7
|
+
# compound-token-split-by-macro was added in clang 12 and broke
|
8
|
+
# compilation with some of the ruby headers. If the current compiler
|
9
|
+
# supports the new warning, turn it off.
|
10
|
+
new_warning = '-Wno-error=compound-token-split-by-macro'
|
11
|
+
if try_cflags(new_warning)
|
12
|
+
$CFLAGS += ' ' + new_warning
|
13
|
+
end
|
14
|
+
|
4
15
|
extension_name = "appmap"
|
5
16
|
dir_config(extension_name)
|
6
17
|
create_makefile(File.join(extension_name, extension_name))
|
@@ -10,7 +10,14 @@ module AppMap
|
|
10
10
|
|
11
11
|
class Validate < ValidateStruct
|
12
12
|
def perform
|
13
|
-
|
13
|
+
schema_path = File.expand_path('../../../../../config-schema.yml', __FILE__)
|
14
|
+
schema = YAML.safe_load(File.read(schema_path))
|
15
|
+
result = {
|
16
|
+
version: 2,
|
17
|
+
errors: config_validator.valid? ? [] : config_validator.violations.map(&:to_h),
|
18
|
+
schema: schema
|
19
|
+
}
|
20
|
+
puts JSON.pretty_generate(result)
|
14
21
|
end
|
15
22
|
|
16
23
|
private
|
data/lib/appmap/config.rb
CHANGED
@@ -176,8 +176,8 @@ module AppMap
|
|
176
176
|
package_hooks('actionpack',
|
177
177
|
[
|
178
178
|
method_hook('ActionDispatch::Request::Session', %i[[] dig values fetch], %w[http.session.read]),
|
179
|
-
method_hook('ActionDispatch::Request::Session', %i[destroy[]= clear update delete merge], %w[http.session.write]),
|
180
|
-
method_hook('ActionDispatch::Cookies::CookieJar', %i[[]
|
179
|
+
method_hook('ActionDispatch::Request::Session', %i[destroy []= clear update delete merge], %w[http.session.write]),
|
180
|
+
method_hook('ActionDispatch::Cookies::CookieJar', %i[[] fetch], %w[http.session.read]),
|
181
181
|
method_hook('ActionDispatch::Cookies::CookieJar', %i[[]= clear update delete recycle], %w[http.session.write]),
|
182
182
|
method_hook('ActionDispatch::Cookies::EncryptedCookieJar', %i[[]= clear update delete recycle], %w[http.cookie crypto.encrypt])
|
183
183
|
],
|
@@ -287,7 +287,7 @@ module AppMap
|
|
287
287
|
LOGO
|
288
288
|
end
|
289
289
|
|
290
|
-
config_present = true if File.
|
290
|
+
config_present = true if File.exist?(config_file_name)
|
291
291
|
|
292
292
|
config_data = if config_present
|
293
293
|
YAML.safe_load(::File.read(config_file_name))
|
@@ -360,6 +360,7 @@ module AppMap
|
|
360
360
|
gem = package['gem']
|
361
361
|
path = package['path']
|
362
362
|
raise %q(AppMap config 'package' element should specify 'gem' or 'path', not both) if gem && path
|
363
|
+
raise %q(AppMap config 'package' element should specify 'gem' or 'path') unless gem || path
|
363
364
|
|
364
365
|
if gem
|
365
366
|
shallow = package['shallow']
|
data/lib/appmap/depends/api.rb
CHANGED
@@ -63,7 +63,7 @@ module AppMap
|
|
63
63
|
removed = []
|
64
64
|
out_of_date_appmaps.each do |appmap_path|
|
65
65
|
mtime_path = File.join(appmap_path, 'mtime')
|
66
|
-
next unless File.
|
66
|
+
next unless File.exist?(mtime_path)
|
67
67
|
|
68
68
|
appmap_mtime = File.read(mtime_path).to_i
|
69
69
|
if appmap_mtime < since_ms
|
data/lib/appmap/depends/util.rb
CHANGED
@@ -16,7 +16,7 @@ module AppMap
|
|
16
16
|
def delete_appmap(appmap_path)
|
17
17
|
FileUtils.rm_rf(appmap_path)
|
18
18
|
appmap_file_path = [ appmap_path, 'appmap.json' ].join('.')
|
19
|
-
File.unlink(appmap_file_path) if File.
|
19
|
+
File.unlink(appmap_file_path) if File.exist?(appmap_file_path)
|
20
20
|
rescue
|
21
21
|
warn "Unable to delete AppMap: #{$!}"
|
22
22
|
end
|
data/lib/appmap/event.rb
CHANGED
@@ -111,10 +111,12 @@ module AppMap
|
|
111
111
|
rescue NoMethodError
|
112
112
|
begin
|
113
113
|
value.inspect
|
114
|
-
rescue
|
114
|
+
rescue
|
115
115
|
last_resort_string.call
|
116
116
|
end
|
117
|
-
rescue
|
117
|
+
rescue WeakRef::RefError
|
118
|
+
nil
|
119
|
+
rescue
|
118
120
|
last_resort_string.call
|
119
121
|
end
|
120
122
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'appmap/event'
|
4
4
|
require 'appmap/util'
|
5
|
+
require 'rack'
|
5
6
|
|
6
7
|
module AppMap
|
7
8
|
module Handler
|
@@ -27,7 +28,7 @@ module AppMap
|
|
27
28
|
|
28
29
|
self.request_method = request.method
|
29
30
|
self.url = url
|
30
|
-
self.headers =
|
31
|
+
self.headers = NetHTTP.copy_headers(request)
|
31
32
|
self.params = Rack::Utils.parse_nested_query(query)
|
32
33
|
end
|
33
34
|
|
@@ -55,22 +56,25 @@ module AppMap
|
|
55
56
|
end
|
56
57
|
|
57
58
|
class HTTPClientResponse < AppMap::Event::MethodReturnIgnoreValue
|
58
|
-
attr_accessor :status, :
|
59
|
+
attr_accessor :status, :headers
|
59
60
|
|
60
61
|
def initialize(response, parent_id, elapsed)
|
61
62
|
super AppMap::Event.next_id_counter, :return, Thread.current.object_id
|
62
63
|
|
63
|
-
|
64
|
+
if response
|
65
|
+
self.status = response.code.to_i
|
66
|
+
self.headers = NetHTTP.copy_headers(response)
|
67
|
+
else
|
68
|
+
self.headers = {}
|
69
|
+
end
|
64
70
|
self.parent_id = parent_id
|
65
71
|
self.elapsed = elapsed
|
66
|
-
self.headers = AppMap::Util.select_headers(NetHTTP.response_headers(response))
|
67
72
|
end
|
68
73
|
|
69
74
|
def to_h
|
70
75
|
super.tap do |h|
|
71
76
|
h[:http_client_response] = {
|
72
77
|
status_code: status,
|
73
|
-
mime_type: mime_type,
|
74
78
|
headers: headers
|
75
79
|
}.compact
|
76
80
|
end
|
@@ -79,17 +83,15 @@ module AppMap
|
|
79
83
|
|
80
84
|
class NetHTTP
|
81
85
|
class << self
|
82
|
-
def
|
86
|
+
def copy_headers(obj)
|
83
87
|
{}.tap do |headers|
|
84
|
-
|
85
|
-
key =
|
86
|
-
headers[key] =
|
88
|
+
obj.each_header do |key, value|
|
89
|
+
key = key.split('-').map(&:capitalize).join('-')
|
90
|
+
headers[key] = value
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
90
|
-
|
91
|
-
alias response_headers request_headers
|
92
|
-
|
94
|
+
|
93
95
|
def handle_call(defined_class, hook_method, receiver, args)
|
94
96
|
# request will call itself again in a start block if it's not already started.
|
95
97
|
return unless receiver.started?
|
@@ -9,16 +9,14 @@ module AppMap
|
|
9
9
|
module Rails
|
10
10
|
module RequestHandler
|
11
11
|
class HTTPServerRequest < AppMap::Event::MethodEvent
|
12
|
-
attr_accessor :normalized_path_info, :request_method, :path_info, :params, :
|
12
|
+
attr_accessor :normalized_path_info, :request_method, :path_info, :params, :headers
|
13
13
|
|
14
14
|
def initialize(request)
|
15
15
|
super AppMap::Event.next_id_counter, :call, Thread.current.object_id
|
16
16
|
|
17
17
|
self.request_method = request.request_method
|
18
18
|
self.normalized_path_info = normalized_path(request)
|
19
|
-
self.
|
20
|
-
self.headers = AppMap::Util.select_headers(request.env)
|
21
|
-
self.authorization = request.headers['Authorization']
|
19
|
+
self.headers = AppMap::Util.select_rack_headers(request.env)
|
22
20
|
self.path_info = request.path_info.split('?')[0]
|
23
21
|
# ActionDispatch::Http::ParameterFilter is deprecated
|
24
22
|
parameter_filter_cls = \
|
@@ -35,9 +33,7 @@ module AppMap
|
|
35
33
|
h[:http_server_request] = {
|
36
34
|
request_method: request_method,
|
37
35
|
path_info: path_info,
|
38
|
-
mime_type: mime_type,
|
39
36
|
normalized_path_info: normalized_path_info,
|
40
|
-
authorization: authorization,
|
41
37
|
headers: headers,
|
42
38
|
}.compact
|
43
39
|
|
@@ -72,23 +68,21 @@ module AppMap
|
|
72
68
|
end
|
73
69
|
|
74
70
|
class HTTPServerResponse < AppMap::Event::MethodReturnIgnoreValue
|
75
|
-
attr_accessor :status, :
|
71
|
+
attr_accessor :status, :headers
|
76
72
|
|
77
73
|
def initialize(response, parent_id, elapsed)
|
78
74
|
super AppMap::Event.next_id_counter, :return, Thread.current.object_id
|
79
75
|
|
80
76
|
self.status = response.status
|
81
|
-
self.mime_type = response.headers['Content-Type']
|
82
77
|
self.parent_id = parent_id
|
83
78
|
self.elapsed = elapsed
|
84
|
-
self.headers =
|
79
|
+
self.headers = response.headers.dup
|
85
80
|
end
|
86
81
|
|
87
82
|
def to_h
|
88
83
|
super.tap do |h|
|
89
84
|
h[:http_server_response] = {
|
90
85
|
status_code: status,
|
91
|
-
mime_type: mime_type,
|
92
86
|
headers: headers
|
93
87
|
}.compact
|
94
88
|
end
|
data/lib/appmap/minitest.rb
CHANGED
data/lib/appmap/rspec.rb
CHANGED
data/lib/appmap/util.rb
CHANGED
@@ -108,8 +108,18 @@ module AppMap
|
|
108
108
|
event
|
109
109
|
end
|
110
110
|
|
111
|
-
def
|
111
|
+
def select_rack_headers(env)
|
112
|
+
finalize_headers = lambda do |headers|
|
113
|
+
blank?(headers) ? nil : headers
|
114
|
+
end
|
115
|
+
|
112
116
|
# Rack prepends HTTP_ to all client-sent headers.
|
117
|
+
|
118
|
+
if !env['rack.version']
|
119
|
+
warn "Request headers does not contain rack.version. HTTP_ prefix is not expected."
|
120
|
+
return finalize_headers.call(env.dup)
|
121
|
+
end
|
122
|
+
|
113
123
|
matching_headers = env
|
114
124
|
.select { |k,v| k.start_with? 'HTTP_'}
|
115
125
|
.reject { |k,v| blank?(v) }
|
@@ -118,7 +128,7 @@ module AppMap
|
|
118
128
|
value = kv[1]
|
119
129
|
memo[key] = value
|
120
130
|
end
|
121
|
-
|
131
|
+
finalize_headers.call(matching_headers)
|
122
132
|
end
|
123
133
|
|
124
134
|
def normalize_path(path)
|
data/lib/appmap/version.rb
CHANGED
data/lib/appmap.rb
CHANGED
@@ -74,6 +74,6 @@ lambda do
|
|
74
74
|
require 'appmap/depends'
|
75
75
|
end
|
76
76
|
|
77
|
-
end.call
|
77
|
+
end.call unless ENV['APPMAP_AUTOREQUIRE'] == 'false'
|
78
78
|
|
79
|
-
AppMap.initialize_configuration if ENV['APPMAP'] == 'true'
|
79
|
+
AppMap.initialize_configuration if ENV['APPMAP'] == 'true' && ENV['APPMAP_INITIALIZE'] != 'false'
|
data/spec/depends/api_spec.rb
CHANGED
@@ -93,9 +93,9 @@ describe 'Depends API' do
|
|
93
93
|
|
94
94
|
test_report.clean_appmaps
|
95
95
|
|
96
|
-
expect(File.
|
96
|
+
expect(File.exist?(new_spec_file)).to be_falsey
|
97
97
|
ensure
|
98
|
-
FileUtils.rm_f new_spec_file if File.
|
98
|
+
FileUtils.rm_f new_spec_file if File.exist?(new_spec_file)
|
99
99
|
FileUtils.rm_rf new_spec_file.split('.')[0]
|
100
100
|
end
|
101
101
|
end
|
@@ -104,7 +104,7 @@ describe 'Depends API' do
|
|
104
104
|
describe '.run_tests' do
|
105
105
|
def run_tests
|
106
106
|
Dir.chdir 'spec/fixtures/depends' do
|
107
|
-
api.run_tests([ 'spec/actual_rspec_test.rb', 'test/actual_minitest_test.rb' ], appmap_dir: Pathname.new(
|
107
|
+
api.run_tests([ 'spec/actual_rspec_test.rb', 'test/actual_minitest_test.rb' ], appmap_dir: Pathname.new('.').expand_path.to_s)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -58,7 +58,7 @@ describe 'Rails' do
|
|
58
58
|
hash_including(
|
59
59
|
'http_server_response' => hash_including(
|
60
60
|
'status_code' => 201,
|
61
|
-
'
|
61
|
+
'headers' => hash_including('Content-Type' => 'application/json; charset=utf-8'),
|
62
62
|
)
|
63
63
|
)
|
64
64
|
)
|
data/spec/rails_spec_helper.rb
CHANGED
@@ -5,9 +5,14 @@ require 'active_support'
|
|
5
5
|
require 'active_support/core_ext'
|
6
6
|
require 'open3'
|
7
7
|
|
8
|
+
# docker compose v2 replaced the --filter flag with --status
|
9
|
+
PS_CMD=`docker-compose --version` =~ /version v2/ ?
|
10
|
+
"docker-compose ps -q --status running" :
|
11
|
+
"docker-compose ps -q --filter health=healthy"
|
12
|
+
|
8
13
|
def wait_for_container(app_name)
|
9
14
|
start_time = Time.now
|
10
|
-
until
|
15
|
+
until `#{PS_CMD} #{app_name}`.strip != ''
|
11
16
|
elapsed = Time.now - start_time
|
12
17
|
raise "Timeout waiting for container #{app_name} to be ready" if elapsed > 10
|
13
18
|
|
@@ -2,27 +2,40 @@
|
|
2
2
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
|
+
schema_path = File.expand_path('../../config-schema.yml', __FILE__)
|
6
|
+
CONFIG_SCHEMA = YAML.safe_load(File.read(schema_path))
|
5
7
|
class AgentSetupValidateTest < Minitest::Test
|
6
8
|
NON_EXISTING_CONFIG_FILENAME = '123.yml'
|
7
9
|
INVALID_YAML_CONFIG_FILENAME = 'spec/fixtures/config/invalid_yaml_config.yml'
|
8
10
|
INVALID_CONFIG_FILENAME = 'spec/fixtures/config/invalid_config.yml'
|
11
|
+
MISSING_PATH_OR_GEM_CONFIG_FILENAME = 'spec/fixtures/config/missing_path_or_gem.yml'
|
9
12
|
|
13
|
+
def check_output(output, expected_errors)
|
14
|
+
expected = JSON.pretty_generate(
|
15
|
+
{
|
16
|
+
version: 2,
|
17
|
+
errors: expected_errors,
|
18
|
+
schema: CONFIG_SCHEMA
|
19
|
+
}
|
20
|
+
)
|
21
|
+
assert_equal(expected, output.strip)
|
22
|
+
end
|
23
|
+
|
10
24
|
def test_init_when_config_exists
|
11
25
|
output = `./exe/appmap-agent-validate`
|
12
26
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
13
|
-
|
27
|
+
check_output(output, [
|
14
28
|
{
|
15
29
|
level: :error,
|
16
30
|
message: 'AppMap auto-configuration is currently not available for non Rails projects'
|
17
31
|
}
|
18
32
|
])
|
19
|
-
assert_equal expected, output.strip
|
20
33
|
end
|
21
34
|
|
22
35
|
def test_init_with_non_existing_config_file
|
23
36
|
output = `./exe/appmap-agent-validate -c #{NON_EXISTING_CONFIG_FILENAME}`
|
24
37
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
25
|
-
|
38
|
+
check_output(output, [
|
26
39
|
{
|
27
40
|
level: :error,
|
28
41
|
message: 'AppMap auto-configuration is currently not available for non Rails projects'
|
@@ -33,13 +46,12 @@ class AgentSetupValidateTest < Minitest::Test
|
|
33
46
|
message: "AppMap configuration #{NON_EXISTING_CONFIG_FILENAME} file does not exist"
|
34
47
|
}
|
35
48
|
])
|
36
|
-
assert_equal expected, output.strip
|
37
49
|
end
|
38
50
|
|
39
51
|
def test_init_with_invalid_YAML
|
40
52
|
output = `./exe/appmap-agent-validate -c #{INVALID_YAML_CONFIG_FILENAME}`
|
41
53
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
42
|
-
|
54
|
+
check_output(output, [
|
43
55
|
{
|
44
56
|
level: :error,
|
45
57
|
message: 'AppMap auto-configuration is currently not available for non Rails projects'
|
@@ -52,13 +64,12 @@ class AgentSetupValidateTest < Minitest::Test
|
|
52
64
|
'did not find expected key while parsing a block mapping at line 1 column 1'
|
53
65
|
}
|
54
66
|
])
|
55
|
-
assert_equal expected, output.strip
|
56
67
|
end
|
57
68
|
|
58
69
|
def test_init_with_invalid_data_config
|
59
70
|
output = `./exe/appmap-agent-validate -c #{INVALID_CONFIG_FILENAME}`
|
60
71
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
61
|
-
|
72
|
+
check_output(output, [
|
62
73
|
{
|
63
74
|
level: :error,
|
64
75
|
message: 'AppMap auto-configuration is currently not available for non Rails projects'
|
@@ -70,6 +81,22 @@ class AgentSetupValidateTest < Minitest::Test
|
|
70
81
|
detailed_message: "no implicit conversion of String into Integer"
|
71
82
|
}
|
72
83
|
])
|
73
|
-
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_init_with_missing_package_key
|
87
|
+
output = `./exe/appmap-agent-validate -c #{MISSING_PATH_OR_GEM_CONFIG_FILENAME}`
|
88
|
+
assert_equal 0, $CHILD_STATUS.exitstatus
|
89
|
+
check_output(output, [
|
90
|
+
{
|
91
|
+
level: :error,
|
92
|
+
message: 'AppMap auto-configuration is currently not available for non Rails projects'
|
93
|
+
},
|
94
|
+
{
|
95
|
+
level: :error,
|
96
|
+
filename: MISSING_PATH_OR_GEM_CONFIG_FILENAME,
|
97
|
+
message: "AppMap configuration #{MISSING_PATH_OR_GEM_CONFIG_FILENAME} could not be loaded",
|
98
|
+
detailed_message: "AppMap config 'package' element should specify 'gem' or 'path'"
|
99
|
+
}
|
100
|
+
])
|
74
101
|
end
|
75
102
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
|
5
|
+
require 'appmap'
|
6
|
+
require 'appmap/minitest' if ENV['APPMAP_AUTOREQUIRE'] == 'false'
|
7
|
+
|
8
|
+
require 'sheep'
|
9
|
+
require 'mocha/minitest'
|
10
|
+
|
11
|
+
class SheepTest < Minitest::Test
|
12
|
+
def test_sheep
|
13
|
+
sheep = mock('sheep')
|
14
|
+
sheep.responds_like(Sheep.new)
|
15
|
+
sheep.expects(:baa).returns('baa')
|
16
|
+
sheep.baa
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
|
6
|
+
class MockCompatibilityTest < Minitest::Test
|
7
|
+
def perform_minitest_test(test_name, env = {})
|
8
|
+
Bundler.with_clean_env do
|
9
|
+
Dir.chdir 'test/fixtures/mocha_mock_app' do
|
10
|
+
FileUtils.rm_rf 'tmp'
|
11
|
+
system 'bundle config --local local.appmap ../../..'
|
12
|
+
system 'bundle'
|
13
|
+
system(env.merge({ 'APPMAP' => 'true' }), %(bundle exec ruby -Ilib -Itest test/#{test_name}_test.rb))
|
14
|
+
|
15
|
+
yield
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_expectation
|
21
|
+
perform_minitest_test('sheep') do
|
22
|
+
appmap_file = 'tmp/appmap/minitest/Sheep_sheep.appmap.json'
|
23
|
+
|
24
|
+
assert File.file?(appmap_file), 'appmap output file does not exist'
|
25
|
+
appmap = JSON.parse(File.read(appmap_file))
|
26
|
+
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
27
|
+
assert_includes appmap.keys, 'metadata'
|
28
|
+
metadata = appmap['metadata']
|
29
|
+
assert_equal 'succeeded', metadata['test_status']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_expectation_without_autorequire
|
34
|
+
perform_minitest_test('sheep', 'APPMAP_AUTOREQUIRE' => 'false') do
|
35
|
+
appmap_file = 'tmp/appmap/minitest/Sheep_sheep.appmap.json'
|
36
|
+
|
37
|
+
assert File.file?(appmap_file), 'appmap output file does not exist'
|
38
|
+
appmap = JSON.parse(File.read(appmap_file))
|
39
|
+
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
40
|
+
assert_includes appmap.keys, 'metadata'
|
41
|
+
metadata = appmap['metadata']
|
42
|
+
assert_equal 'succeeded', metadata['test_status']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.67.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -3462,6 +3462,7 @@ files:
|
|
3462
3462
|
- spec/fixtures/config/incomplete_config.yml
|
3463
3463
|
- spec/fixtures/config/invalid_config.yml
|
3464
3464
|
- spec/fixtures/config/invalid_yaml_config.yml
|
3465
|
+
- spec/fixtures/config/missing_path_or_gem.yml
|
3465
3466
|
- spec/fixtures/config/valid_config.yml
|
3466
3467
|
- spec/fixtures/depends/.gitignore
|
3467
3468
|
- spec/fixtures/depends/app/controllers/api/api_keys_controller.rb
|
@@ -3698,6 +3699,10 @@ files:
|
|
3698
3699
|
- test/fixtures/minitest_recorder/appmap.yml
|
3699
3700
|
- test/fixtures/minitest_recorder/lib/hello.rb
|
3700
3701
|
- test/fixtures/minitest_recorder/test/hello_test.rb
|
3702
|
+
- test/fixtures/mocha_mock_app/Gemfile
|
3703
|
+
- test/fixtures/mocha_mock_app/appmap.yml
|
3704
|
+
- test/fixtures/mocha_mock_app/lib/sheep.rb
|
3705
|
+
- test/fixtures/mocha_mock_app/test/sheep_test.rb
|
3701
3706
|
- test/fixtures/openssl_recorder/Gemfile
|
3702
3707
|
- test/fixtures/openssl_recorder/appmap.yml
|
3703
3708
|
- test/fixtures/openssl_recorder/lib/openssl_cert_sign.rb
|
@@ -3714,6 +3719,7 @@ files:
|
|
3714
3719
|
- test/gem_test.rb
|
3715
3720
|
- test/inspect_cli_test.rb
|
3716
3721
|
- test/minitest_test.rb
|
3722
|
+
- test/mock_compatibility_test.rb
|
3717
3723
|
- test/openssl_test.rb
|
3718
3724
|
- test/record_process_test.rb
|
3719
3725
|
- test/rspec_test.rb
|
@@ -3738,7 +3744,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3738
3744
|
- !ruby/object:Gem::Version
|
3739
3745
|
version: '0'
|
3740
3746
|
requirements: []
|
3741
|
-
rubygems_version: 3.0.
|
3747
|
+
rubygems_version: 3.0.6
|
3742
3748
|
signing_key:
|
3743
3749
|
specification_version: 4
|
3744
3750
|
summary: Record the operation of a Ruby program, using the AppLand 'AppMap' format.
|