appmap 0.57.1 → 0.58.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/appmap/command/agent_setup/status.rb +14 -11
- data/lib/appmap/service/integration_test_path_finder.rb +44 -0
- data/lib/appmap/service/test_command_provider.rb +54 -0
- data/lib/appmap/service/test_framework_detector.rb +21 -0
- 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_status_test.rb +51 -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: ca5a16a5edc35706d33aa6ec21e45b5641aa9342b6fc5ab03ada141556c2b859
|
4
|
+
data.tar.gz: 7a4b5b6ff0c504814b7eccebba46a739cc4e00fcf6eb1e5492ef7f52d2f887d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5267e3ba0827671d825ca0bb0323965ae0d8b5c0ac772f95721227af2b66a3a2d2843f7813a4f1faff997e49cd83dc4b7d78a57cb3b4852cfd6fbe63290aa223
|
7
|
+
data.tar.gz: cdb60a38a5d9c836a159c9473a7bf42e06589926ec7011b5978add71dca14ef6fd8acc807d7ef745e3d17ab908e38eca49bfbb3094c5b48a97d4084d9a2f34d8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.58.0](https://github.com/applandinc/appmap-ruby/compare/v0.57.1...v0.58.0) (2021-07-06)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Add `test_commands` sections to `appmap-agent-status` executable ([4cd8fe5](https://github.com/applandinc/appmap-ruby/commit/4cd8fe58acb4af72b7818db96de9e479562b9ea0))
|
7
|
+
|
1
8
|
## [0.57.1](https://github.com/applandinc/appmap-ruby/compare/v0.57.0...v0.57.1) (2021-07-02)
|
2
9
|
|
3
10
|
|
@@ -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
|
@@ -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,54 @@
|
|
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: "APPMAP=true bundle exec rspec #{integration_test_paths[:rspec].join(' ')}"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
if TestFrameworkDetector.minitest_present? && !integration_test_paths[:minitest].empty?
|
21
|
+
commands << {
|
22
|
+
framework: :minitest,
|
23
|
+
command: minitest_command
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
if TestFrameworkDetector.cucumber_present? && !integration_test_paths[:cucumber].empty?
|
28
|
+
commands << {
|
29
|
+
framework: :cucumber,
|
30
|
+
command: 'APPMAP=true bundle exec cucumber'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
commands
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def minitest_command
|
40
|
+
if Gem.loaded_specs.has_key?('rails')
|
41
|
+
"APPMAP=true bundle exec rails test #{integration_test_paths[:minitest].join(' ')}"
|
42
|
+
else
|
43
|
+
subcommands = integration_test_paths[:minitest].map { |path| "APPMAP=true bundle exec ruby #{path}" }
|
44
|
+
subcommands.join(' && ')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def integration_test_paths
|
49
|
+
@paths ||= Service::IntegrationTestPathFinder.find
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
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/version.rb
CHANGED
@@ -4,24 +4,62 @@
|
|
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
|
+
def test_status
|
31
|
+
output = `cd spec/fixtures/rails6_users_app && bundle exec ../../../exe/appmap-agent-status`
|
32
|
+
assert_equal 0, $CHILD_STATUS.exitstatus
|
33
|
+
expected = {
|
34
|
+
test_commands: [
|
35
|
+
{
|
36
|
+
framework: :rspec,
|
37
|
+
command: 'APPMAP=true bundle exec rspec spec/controllers'
|
38
|
+
},
|
39
|
+
{
|
40
|
+
framework: :minitest,
|
41
|
+
command: 'APPMAP=true bundle exec ruby test/controllers && APPMAP=true bundle exec ruby test/integration'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
framework: :cucumber,
|
45
|
+
command: 'APPMAP=true bundle exec cucumber'
|
46
|
+
}
|
47
|
+
],
|
48
|
+
properties: {
|
49
|
+
config: {
|
50
|
+
app: nil,
|
51
|
+
present: true,
|
52
|
+
valid: true
|
53
|
+
},
|
54
|
+
project: {
|
55
|
+
agentVersion: AppMap::VERSION,
|
56
|
+
language: 'ruby',
|
57
|
+
remoteRecordingCapable: false,
|
58
|
+
integrationTests: true
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
assert_equal JSON.pretty_generate(expected), output.strip
|
63
|
+
end
|
26
64
|
end
|
27
65
|
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.58.0
|
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-07-
|
11
|
+
date: 2021-07-06 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
|