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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e1ad8b152e2dbb26fd8b62042a4908f09c46b5dea88a9e05dc2a431b0fd2674
4
- data.tar.gz: 9fa1719c374839b8a7827265771d0db2e25e11a27860240bd17b5155ea7029ed
3
+ metadata.gz: ca5a16a5edc35706d33aa6ec21e45b5641aa9342b6fc5ab03ada141556c2b859
4
+ data.tar.gz: 7a4b5b6ff0c504814b7eccebba46a739cc4e00fcf6eb1e5492ef7f52d2f887d6
5
5
  SHA512:
6
- metadata.gz: e38b17165142f6e5c574ee0cfda832baf2f27ac0c66b90e979a88c5280f66b659e53e3f919a24eb72cd132be6ec321a01708fa73f4c9d54bdaedacc137202895
7
- data.tar.gz: 7d873528d6c51980d88816f74981da0d427697b4f720dfae9b34cd2ff616fd309935487c3187b603d44e2fa74930bbc90a5441f68c7f045829ffee6269cf7ebe
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
- :properties => {
15
- :config => {
16
- :app => config_analyzer.app_name,
17
- :present => config_analyzer.present?,
18
- :valid => config_analyzer.valid?
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
- :project => {
21
- :agentVersion => AppMap::VERSION,
22
- :language => 'ruby',
23
- :remoteRecordingCapable => Gem.loaded_specs.has_key?('rails'),
24
- :integrationTests => false #TODO
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.to_json
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
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.57.1'
6
+ VERSION = '0.58.0'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
 
@@ -0,0 +1,10 @@
1
+ # minitest_calc_test_unit_format_spec.rb
2
+
3
+ require "minitest/autorun"
4
+
5
+ class FunctionalCalcTest < Minitest::Test
6
+ def test_add
7
+ puts 'functional'
8
+ assert_equal 2 + 2, 4
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # minitest_calc_test_unit_format_spec.rb
2
+
3
+ require "minitest/autorun"
4
+
5
+ class IntegrationCalcTest < Minitest::Test
6
+ class CalcTest < Minitest::Test
7
+ def test_add
8
+ puts 'integration'
9
+ assert_equal 2 + 2, 4
10
+ end
11
+ end
12
+ end
@@ -4,24 +4,62 @@
4
4
  require 'test_helper'
5
5
 
6
6
  class AgentSetupInitTest < Minitest::Test
7
- def test_status
7
+ def test_status_gem
8
8
  output = `./exe/appmap-agent-status`
9
9
  assert_equal 0, $CHILD_STATUS.exitstatus
10
10
  expected = {
11
- :properties => {
12
- :config => {
13
- :app => 'AppMap Rubygem',
14
- :present => true,
15
- :valid => true
11
+ test_commands: [],
12
+ properties: {
13
+ config: {
14
+ app: 'AppMap Rubygem',
15
+ present: true,
16
+ valid: true
16
17
  },
17
- :project => {
18
- :agentVersion => AppMap::VERSION,
19
- :language => 'ruby',
20
- :remoteRecordingCapable => false,
21
- :integrationTests => false
18
+ project: {
19
+ agentVersion: AppMap::VERSION,
20
+ language: 'ruby',
21
+ remoteRecordingCapable: false,
22
+ integrationTests: false
22
23
  }
23
24
  }
24
- }.to_json
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.57.1
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-02 00:00:00.000000000 Z
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