appmap 0.56.0 → 0.59.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/lib/appmap/command/agent_setup/init.rb +8 -22
- data/lib/appmap/command/agent_setup/status.rb +14 -11
- data/lib/appmap/event.rb +8 -0
- data/lib/appmap/handler/rails/template.rb +9 -4
- data/lib/appmap/service/integration_test_path_finder.rb +44 -0
- data/lib/appmap/service/test_command_provider.rb +77 -0
- data/lib/appmap/service/test_framework_detector.rb +21 -0
- data/lib/appmap/trace.rb +2 -2
- data/lib/appmap/version.rb +1 -1
- data/spec/fixtures/rails6_users_app/test/controllers/functional_calc_test.rb +10 -0
- data/spec/fixtures/rails6_users_app/test/integration/integration_calc_test.rb +12 -0
- data/test/agent_setup_init_test.rb +16 -16
- data/test/agent_setup_status_test.rb +67 -13
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63240e66f2942705bc89667ac6bdf7af49fc9e1c2225d4a6ffd243ad43ccbb80
|
4
|
+
data.tar.gz: 7f0d20e3b75dee93c32cab9d99844528ba35aa2e4987ec649e3194a806b1de8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f3892093241092685b18ebd1f5f2a63e4f697c6099b32bd6cabfe2edba79448542ecc7c3080c69e4bdad8732805e69bd80b5bbc2c3b21a15f4085d3034520d1
|
7
|
+
data.tar.gz: 8279d3bd2403bf28f255c7c985e90760e7700a865259865a89ec793cf5539a5caab7810b153a1bc9ca2b09c9654edd84db94c1535fdd155ea4d7181dfc914eef
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
## [0.59.1](https://github.com/applandinc/appmap-ruby/compare/v0.59.0...v0.59.1) (2021-07-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Events may be constructed in stages ([b0b23f5](https://github.com/applandinc/appmap-ruby/commit/b0b23f59a84158b8162424b84430894fe4278324))
|
7
|
+
|
8
|
+
# [0.59.0](https://github.com/applandinc/appmap-ruby/compare/v0.58.0...v0.59.0) (2021-07-07)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* define commands as objects ([1b43203](https://github.com/applandinc/appmap-ruby/commit/1b432039040277e1b5349cc2f75aa436238ea873))
|
14
|
+
|
15
|
+
# [0.58.0](https://github.com/applandinc/appmap-ruby/compare/v0.57.1...v0.58.0) (2021-07-06)
|
16
|
+
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* Add `test_commands` sections to `appmap-agent-status` executable ([4cd8fe5](https://github.com/applandinc/appmap-ruby/commit/4cd8fe58acb4af72b7818db96de9e479562b9ea0))
|
21
|
+
|
22
|
+
## [0.57.1](https://github.com/applandinc/appmap-ruby/compare/v0.57.0...v0.57.1) (2021-07-02)
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* rename agentVersionPorject to agentVersion ([905fc5d](https://github.com/applandinc/appmap-ruby/commit/905fc5dd643411deb94f8a1087bcdb3a562d218a))
|
28
|
+
|
29
|
+
# [0.57.0](https://github.com/applandinc/appmap-ruby/compare/v0.56.0...v0.57.0) (2021-06-29)
|
30
|
+
|
31
|
+
|
32
|
+
### Features
|
33
|
+
|
34
|
+
* Update init command to return JSON ([1f93e89](https://github.com/applandinc/appmap-ruby/commit/1f93e8909684e1018f513d69adfde2a5d0bf6bc9))
|
35
|
+
|
1
36
|
# [0.56.0](https://github.com/applandinc/appmap-ruby/compare/v0.55.0...v0.56.0) (2021-06-28)
|
2
37
|
|
3
38
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'json'
|
4
4
|
require 'appmap/service/guesser'
|
5
|
-
require 'appmap/util'
|
6
5
|
|
7
6
|
module AppMap
|
8
7
|
module Command
|
@@ -11,32 +10,19 @@ module AppMap
|
|
11
10
|
|
12
11
|
class Init < InitStruct
|
13
12
|
def perform
|
14
|
-
if File.exist?(config_file)
|
15
|
-
puts AppMap::Util.color(%(The AppMap config file #{config_file} already exists.), :magenta)
|
16
|
-
return
|
17
|
-
end
|
18
|
-
|
19
|
-
ensure_directory_exists
|
20
|
-
|
21
13
|
config = {
|
22
14
|
'name' => Service::Guesser.guess_name,
|
23
15
|
'packages' => Service::Guesser.guess_paths.map { |path| { 'path' => path } }
|
24
16
|
}
|
25
|
-
content = YAML.dump(config).gsub("---\n", '')
|
26
17
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
18
|
+
result = {
|
19
|
+
configuration: {
|
20
|
+
filename: config_file,
|
21
|
+
contents: YAML.dump(config)
|
22
|
+
}
|
23
|
+
}
|
36
24
|
|
37
|
-
|
38
|
-
dirname = File.dirname(config_file)
|
39
|
-
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
25
|
+
puts JSON.pretty_generate(result)
|
40
26
|
end
|
41
27
|
end
|
42
28
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'json'
|
4
4
|
require 'appmap/service/config_analyzer'
|
5
|
+
require 'appmap/service/integration_test_path_finder'
|
6
|
+
require 'appmap/service/test_command_provider'
|
5
7
|
|
6
8
|
module AppMap
|
7
9
|
module Command
|
@@ -11,22 +13,23 @@ module AppMap
|
|
11
13
|
class Status < StatusStruct
|
12
14
|
def perform
|
13
15
|
status = {
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
:
|
18
|
-
:
|
16
|
+
test_commands: Service::TestCommandProvider.all,
|
17
|
+
properties: {
|
18
|
+
config: {
|
19
|
+
app: config_analyzer.app_name,
|
20
|
+
present: config_analyzer.present?,
|
21
|
+
valid: config_analyzer.valid?
|
19
22
|
},
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
23
|
+
project: {
|
24
|
+
agentVersion: AppMap::VERSION,
|
25
|
+
language: 'ruby',
|
26
|
+
remoteRecordingCapable: Gem.loaded_specs.has_key?('rails'),
|
27
|
+
integrationTests: Service::IntegrationTestPathFinder.count_paths > 0
|
25
28
|
}
|
26
29
|
}
|
27
30
|
}
|
28
31
|
|
29
|
-
puts status
|
32
|
+
puts JSON.pretty_generate(status)
|
30
33
|
end
|
31
34
|
|
32
35
|
private
|
data/lib/appmap/event.rb
CHANGED
@@ -119,6 +119,14 @@ module AppMap
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
122
|
+
|
123
|
+
# An event may be partially constructed, and then completed at a later time. When the event
|
124
|
+
# is only partially constructed, it's not ready for serialization to the AppMap file.
|
125
|
+
#
|
126
|
+
# @return false until the event is fully constructed and available.
|
127
|
+
def ready?
|
128
|
+
true
|
129
|
+
end
|
122
130
|
|
123
131
|
protected
|
124
132
|
|
@@ -71,11 +71,16 @@ module AppMap
|
|
71
71
|
attr_reader :render_instance
|
72
72
|
# Path to the view template.
|
73
73
|
attr_accessor :path
|
74
|
-
|
74
|
+
# Indicates when the event is fully constructed.
|
75
|
+
attr_accessor :ready
|
76
|
+
|
77
|
+
alias ready? ready
|
78
|
+
|
75
79
|
def initialize(render_instance)
|
76
80
|
super :call
|
77
81
|
|
78
82
|
AppMap::Event::MethodEvent.build_from_invocation(:call, event: self)
|
83
|
+
@ready = false
|
79
84
|
@render_instance = render_instance
|
80
85
|
end
|
81
86
|
|
@@ -95,8 +100,7 @@ module AppMap
|
|
95
100
|
object_id: render_instance.__id__,
|
96
101
|
value: AppMap::Event::MethodEvent.display_string(render_instance)
|
97
102
|
}
|
98
|
-
|
99
|
-
end
|
103
|
+
end.compact
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
@@ -158,7 +162,8 @@ module AppMap
|
|
158
162
|
end
|
159
163
|
|
160
164
|
def handle_return(call_event_id, elapsed, return_value, exception)
|
161
|
-
Array(Thread.current[TEMPLATE_RENDERER]).pop
|
165
|
+
template_call = Array(Thread.current[TEMPLATE_RENDERER]).pop
|
166
|
+
template_call.ready = true
|
162
167
|
|
163
168
|
AppMap::Event::MethodReturnIgnoreValue.build_from_invocation(call_event_id, elapsed: elapsed)
|
164
169
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'appmap/service/test_framework_detector'
|
4
|
+
|
5
|
+
module AppMap
|
6
|
+
module Service
|
7
|
+
class IntegrationTestPathFinder
|
8
|
+
class << self
|
9
|
+
def find
|
10
|
+
@paths ||= begin
|
11
|
+
paths = { rspec: [], minitest: [], cucumber: [] }
|
12
|
+
paths[:rspec] = find_rspec_paths if TestFrameworkDetector.rspec_present?
|
13
|
+
paths[:minitest] = find_minitest_paths if TestFrameworkDetector.minitest_present?
|
14
|
+
paths[:cucumber] = find_cucumber_paths if TestFrameworkDetector.cucumber_present?
|
15
|
+
paths
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def count_paths
|
20
|
+
find.flatten(2).length - 3
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def find_rspec_paths
|
26
|
+
find_non_empty_paths(%w[spec/controllers spec/requests spec/integration spec/api spec/features spec/system])
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def find_minitest_paths
|
31
|
+
find_non_empty_paths(%w[test/controllers test/integration])
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_cucumber_paths
|
35
|
+
find_non_empty_paths(%w[features])
|
36
|
+
end
|
37
|
+
|
38
|
+
def find_non_empty_paths(paths)
|
39
|
+
paths.select { |path| Dir.exist?(path) && !Dir.empty?(path) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'appmap/service/test_framework_detector'
|
4
|
+
require 'appmap/service/integration_test_path_finder'
|
5
|
+
|
6
|
+
module AppMap
|
7
|
+
module Service
|
8
|
+
class TestCommandProvider
|
9
|
+
class << self
|
10
|
+
def all
|
11
|
+
commands = []
|
12
|
+
|
13
|
+
if TestFrameworkDetector.rspec_present? && !integration_test_paths[:rspec].empty?
|
14
|
+
commands << {
|
15
|
+
framework: :rspec,
|
16
|
+
command: {
|
17
|
+
program: 'bundle',
|
18
|
+
args: %w[exec rspec] + integration_test_paths[:rspec].map { |path| "./#{path}" },
|
19
|
+
environment: {
|
20
|
+
APPMAP: 'true'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
if TestFrameworkDetector.minitest_present? && !integration_test_paths[:minitest].empty?
|
27
|
+
commands += minitest_commands
|
28
|
+
end
|
29
|
+
if TestFrameworkDetector.cucumber_present? && !integration_test_paths[:cucumber].empty?
|
30
|
+
commands << {
|
31
|
+
framework: :cucumber,
|
32
|
+
command: {
|
33
|
+
program: 'bundle',
|
34
|
+
args: %w[exec cucumber],
|
35
|
+
environment: { APPMAP: 'true' }
|
36
|
+
}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
commands
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def minitest_commands
|
46
|
+
if Gem.loaded_specs.has_key?('rails')
|
47
|
+
[
|
48
|
+
{
|
49
|
+
framework: :minitest,
|
50
|
+
command: {
|
51
|
+
program: 'bundle',
|
52
|
+
args: %w[exec rails test] + integration_test_paths[:minitest].map { |path| "./#{path}" },
|
53
|
+
environment: { APPMAP: 'true' }
|
54
|
+
}
|
55
|
+
}
|
56
|
+
]
|
57
|
+
else
|
58
|
+
integration_test_paths[:minitest].map do |path|
|
59
|
+
{
|
60
|
+
framework: :minitest,
|
61
|
+
command: {
|
62
|
+
program: 'bundle',
|
63
|
+
args: ['exec', 'ruby', "./#{path}"],
|
64
|
+
environment: { APPMAP: 'true' }
|
65
|
+
}
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def integration_test_paths
|
72
|
+
@paths ||= Service::IntegrationTestPathFinder.find
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AppMap
|
4
|
+
module Service
|
5
|
+
class TestFrameworkDetector
|
6
|
+
class << self
|
7
|
+
def rspec_present?
|
8
|
+
Gem.loaded_specs.has_key?('rspec-core')
|
9
|
+
end
|
10
|
+
|
11
|
+
def minitest_present?
|
12
|
+
Gem.loaded_specs.has_key?('minitest')
|
13
|
+
end
|
14
|
+
|
15
|
+
def cucumber_present?
|
16
|
+
Gem.loaded_specs.has_key?('cucumber')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/appmap/trace.rb
CHANGED
@@ -143,12 +143,12 @@ module AppMap
|
|
143
143
|
|
144
144
|
# Whether there is an event available for processing.
|
145
145
|
def event?
|
146
|
-
!@events.empty?
|
146
|
+
!@events.empty? && @events.first.ready?
|
147
147
|
end
|
148
148
|
|
149
149
|
# Gets the next available event, if any.
|
150
150
|
def next_event
|
151
|
-
@events.shift
|
151
|
+
@events.shift if event?
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
data/lib/appmap/version.rb
CHANGED
@@ -5,8 +5,8 @@ require 'test_helper'
|
|
5
5
|
|
6
6
|
class AgentSetupInitTest < Minitest::Test
|
7
7
|
CONFIG_FILENAME = '123.yml'
|
8
|
-
|
9
|
-
|
8
|
+
EXPECTED_CONFIG_CONTENT = %(---
|
9
|
+
name: appmap-ruby
|
10
10
|
packages:
|
11
11
|
- path: lib
|
12
12
|
)
|
@@ -14,24 +14,24 @@ packages:
|
|
14
14
|
def test_init_when_config_exists
|
15
15
|
output = `./exe/appmap-agent-init`
|
16
16
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
17
|
-
|
17
|
+
expected = JSON.pretty_generate({
|
18
|
+
configuration: {
|
19
|
+
filename: 'appmap.yml',
|
20
|
+
contents: EXPECTED_CONFIG_CONTENT
|
21
|
+
}
|
22
|
+
})
|
23
|
+
assert_equal expected, output.strip
|
18
24
|
end
|
19
25
|
|
20
26
|
def test_init_with_custom_config_filename
|
21
27
|
output = `./exe/appmap-agent-init -c #{CONFIG_FILENAME}`
|
22
28
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
output = `./exe/appmap-agent-init --config=#{SUBFOLDER_CONFIG_FILEPATH}`
|
31
|
-
assert_equal 0, $CHILD_STATUS.exitstatus
|
32
|
-
assert_includes output, "The following AppMap config file #{SUBFOLDER_CONFIG_FILEPATH} has been created:"
|
33
|
-
assert_equal EXPECTED_CONFIG_CONTENT, File.read(SUBFOLDER_CONFIG_FILEPATH)
|
34
|
-
ensure
|
35
|
-
File.delete(SUBFOLDER_CONFIG_FILEPATH) if File.exist?(SUBFOLDER_CONFIG_FILEPATH)
|
29
|
+
expected = JSON.pretty_generate({
|
30
|
+
configuration: {
|
31
|
+
filename: CONFIG_FILENAME,
|
32
|
+
contents: EXPECTED_CONFIG_CONTENT
|
33
|
+
}
|
34
|
+
})
|
35
|
+
assert_equal expected, output.strip
|
36
36
|
end
|
37
37
|
end
|
@@ -4,24 +4,78 @@
|
|
4
4
|
require 'test_helper'
|
5
5
|
|
6
6
|
class AgentSetupInitTest < Minitest::Test
|
7
|
-
def
|
7
|
+
def test_status_gem
|
8
8
|
output = `./exe/appmap-agent-status`
|
9
9
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
10
10
|
expected = {
|
11
|
-
:
|
12
|
-
|
13
|
-
|
14
|
-
:
|
15
|
-
:
|
11
|
+
test_commands: [],
|
12
|
+
properties: {
|
13
|
+
config: {
|
14
|
+
app: 'AppMap Rubygem',
|
15
|
+
present: true,
|
16
|
+
valid: true
|
16
17
|
},
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
18
|
+
project: {
|
19
|
+
agentVersion: AppMap::VERSION,
|
20
|
+
language: 'ruby',
|
21
|
+
remoteRecordingCapable: false,
|
22
|
+
integrationTests: false
|
22
23
|
}
|
23
24
|
}
|
24
|
-
}
|
25
|
-
assert_equal expected, output.strip
|
25
|
+
}
|
26
|
+
assert_equal JSON.pretty_generate(expected), output.strip
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_status_rails_app
|
30
|
+
output = `cd spec/fixtures/rails6_users_app && bundle exec ../../../exe/appmap-agent-status`
|
31
|
+
assert_equal 0, $CHILD_STATUS.exitstatus
|
32
|
+
expected = {
|
33
|
+
test_commands: [
|
34
|
+
{
|
35
|
+
framework: :rspec,
|
36
|
+
command: {
|
37
|
+
program: 'bundle',
|
38
|
+
args: %w[exec rspec ./spec/controllers],
|
39
|
+
environment: {
|
40
|
+
APPMAP: 'true'
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
{
|
45
|
+
framework: :minitest,
|
46
|
+
command: {
|
47
|
+
program: 'bundle',
|
48
|
+
args: %w[exec ruby ./test/controllers],
|
49
|
+
environment: {
|
50
|
+
APPMAP: 'true'
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
{
|
55
|
+
framework: :minitest,
|
56
|
+
command: {
|
57
|
+
program: 'bundle',
|
58
|
+
args: %w[exec ruby ./test/integration],
|
59
|
+
environment: {
|
60
|
+
APPMAP: 'true'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
],
|
65
|
+
properties: {
|
66
|
+
config: {
|
67
|
+
app: nil,
|
68
|
+
present: true,
|
69
|
+
valid: false
|
70
|
+
},
|
71
|
+
project: {
|
72
|
+
agentVersion: AppMap::VERSION,
|
73
|
+
language: 'ruby',
|
74
|
+
remoteRecordingCapable: false,
|
75
|
+
integrationTests: true
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
assert_equal JSON.pretty_generate(expected), output.strip
|
26
80
|
end
|
27
81
|
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.59.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-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -356,6 +356,9 @@ files:
|
|
356
356
|
- lib/appmap/rspec.rb
|
357
357
|
- lib/appmap/service/config_analyzer.rb
|
358
358
|
- lib/appmap/service/guesser.rb
|
359
|
+
- lib/appmap/service/integration_test_path_finder.rb
|
360
|
+
- lib/appmap/service/test_command_provider.rb
|
361
|
+
- lib/appmap/service/test_framework_detector.rb
|
359
362
|
- lib/appmap/swagger.rb
|
360
363
|
- lib/appmap/swagger/configuration.rb
|
361
364
|
- lib/appmap/swagger/markdown_descriptions.rb
|
@@ -543,6 +546,8 @@ files:
|
|
543
546
|
- spec/fixtures/rails6_users_app/spec/models/user_spec.rb
|
544
547
|
- spec/fixtures/rails6_users_app/spec/rails_helper.rb
|
545
548
|
- spec/fixtures/rails6_users_app/spec/spec_helper.rb
|
549
|
+
- spec/fixtures/rails6_users_app/test/controllers/functional_calc_test.rb
|
550
|
+
- spec/fixtures/rails6_users_app/test/integration/integration_calc_test.rb
|
546
551
|
- spec/fixtures/rails6_users_app/users_app/.gitignore
|
547
552
|
- spec/hook_spec.rb
|
548
553
|
- spec/open_spec.rb
|