appmap 0.42.0 → 0.45.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.releaserc.yml +11 -0
  3. data/.travis.yml +23 -2
  4. data/CHANGELOG.md +42 -0
  5. data/README.md +65 -6
  6. data/README_CI.md +29 -0
  7. data/Rakefile +4 -2
  8. data/appmap.gemspec +5 -3
  9. data/lib/appmap.rb +4 -7
  10. data/lib/appmap/class_map.rb +7 -10
  11. data/lib/appmap/command/record.rb +1 -1
  12. data/lib/appmap/config.rb +173 -67
  13. data/lib/appmap/cucumber.rb +1 -1
  14. data/lib/appmap/event.rb +18 -0
  15. data/lib/appmap/handler/function.rb +19 -0
  16. data/lib/appmap/handler/net_http.rb +107 -0
  17. data/lib/appmap/hook.rb +112 -56
  18. data/lib/appmap/hook/method.rb +5 -7
  19. data/lib/appmap/middleware/remote_recording.rb +1 -1
  20. data/lib/appmap/minitest.rb +22 -20
  21. data/lib/appmap/rails/request_handler.rb +30 -17
  22. data/lib/appmap/record.rb +1 -1
  23. data/lib/appmap/rspec.rb +23 -21
  24. data/lib/appmap/trace.rb +2 -1
  25. data/lib/appmap/util.rb +47 -2
  26. data/lib/appmap/version.rb +2 -2
  27. data/release.sh +17 -0
  28. data/spec/abstract_controller_base_spec.rb +77 -30
  29. data/spec/class_map_spec.rb +3 -11
  30. data/spec/config_spec.rb +33 -1
  31. data/spec/fixtures/hook/custom_instance_method.rb +11 -0
  32. data/spec/fixtures/hook/method_named_call.rb +11 -0
  33. data/spec/fixtures/rails5_users_app/Gemfile +7 -3
  34. data/spec/fixtures/rails5_users_app/app/controllers/api/users_controller.rb +2 -0
  35. data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +9 -1
  36. data/spec/fixtures/rails5_users_app/config/application.rb +2 -0
  37. data/spec/fixtures/rails5_users_app/create_app +8 -2
  38. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_api_spec.rb +13 -0
  39. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +2 -2
  40. data/spec/fixtures/rails5_users_app/spec/rails_helper.rb +3 -9
  41. data/spec/fixtures/rails6_users_app/Gemfile +5 -4
  42. data/spec/fixtures/rails6_users_app/app/controllers/api/users_controller.rb +1 -0
  43. data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +9 -1
  44. data/spec/fixtures/rails6_users_app/config/application.rb +2 -0
  45. data/spec/fixtures/rails6_users_app/create_app +8 -2
  46. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +13 -0
  47. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +2 -2
  48. data/spec/fixtures/rails6_users_app/spec/rails_helper.rb +3 -9
  49. data/spec/hook_spec.rb +141 -20
  50. data/spec/record_net_http_spec.rb +160 -0
  51. data/spec/record_sql_rails_pg_spec.rb +1 -1
  52. data/spec/spec_helper.rb +16 -0
  53. data/test/expectations/openssl_test_key_sign1.json +2 -4
  54. data/test/gem_test.rb +1 -1
  55. data/test/rspec_test.rb +0 -13
  56. metadata +17 -12
  57. data/exe/appmap +0 -154
  58. data/test/cli_test.rb +0 -116
data/test/cli_test.rb DELETED
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'test_helper'
5
- require 'English'
6
-
7
- class CLITest < Minitest::Test
8
- OUTPUT_FILENAME = File.expand_path('../tmp/appmap.json', __dir__)
9
- STATS_OUTPUT_FILENAME = File.expand_path('../tmp/stats.txt', __dir__)
10
-
11
- def setup
12
- FileUtils.rm_f OUTPUT_FILENAME
13
- FileUtils.rm_f STATS_OUTPUT_FILENAME
14
- end
15
-
16
- def test_record
17
- output = Dir.chdir 'test/fixtures/cli_record_test' do
18
- `#{File.expand_path '../exe/appmap', __dir__} record -o #{OUTPUT_FILENAME} ./lib/cli_record_test/main.rb`.strip
19
- end
20
-
21
- assert_equal 0, $CHILD_STATUS.exitstatus
22
- assert File.file?(OUTPUT_FILENAME), "#{OUTPUT_FILENAME} does not exist"
23
- assert_equal 'Hello', output
24
- output = JSON.parse(File.read(OUTPUT_FILENAME))
25
- assert output['classMap'], 'Output should contain classMap'
26
- assert output['events'], 'Output should contain events'
27
- end
28
-
29
- def test_stats_to_file
30
- Dir.chdir 'test/fixtures/cli_record_test' do
31
- `#{File.expand_path '../exe/appmap', __dir__} record -o #{OUTPUT_FILENAME} ./lib/cli_record_test/main.rb`.strip
32
- end
33
- assert_equal 0, $CHILD_STATUS.exitstatus
34
-
35
- output = Dir.chdir 'test/fixtures/cli_record_test' do
36
- `#{File.expand_path '../exe/appmap', __dir__} stats -o #{STATS_OUTPUT_FILENAME} #{OUTPUT_FILENAME}`.strip
37
- end
38
- assert_equal 0, $CHILD_STATUS.exitstatus
39
- assert_equal '', output
40
- assert File.file?(OUTPUT_FILENAME), "#{OUTPUT_FILENAME} does not exist"
41
- end
42
-
43
-
44
- def test_stats_text
45
- Dir.chdir 'test/fixtures/cli_record_test' do
46
- `#{File.expand_path '../exe/appmap', __dir__} record -o #{OUTPUT_FILENAME} ./lib/cli_record_test/main.rb`.strip
47
- end
48
- assert_equal 0, $CHILD_STATUS.exitstatus
49
-
50
- output = Dir.chdir 'test/fixtures/cli_record_test' do
51
- `#{File.expand_path '../exe/appmap', __dir__} stats -o - #{OUTPUT_FILENAME}`.strip
52
- end
53
-
54
- assert_equal 0, $CHILD_STATUS.exitstatus
55
- assert_equal <<~OUTPUT.strip, output.strip
56
- Class frequency:
57
- ----------------
58
- 1 Main
59
-
60
- Method frequency:
61
- ----------------
62
- 1 Main.say_hello
63
- OUTPUT
64
- end
65
-
66
- def test_stats_json
67
- Dir.chdir 'test/fixtures/cli_record_test' do
68
- `#{File.expand_path '../exe/appmap', __dir__} record -o #{OUTPUT_FILENAME} ./lib/cli_record_test/main.rb`.strip
69
- end
70
- assert_equal 0, $CHILD_STATUS.exitstatus
71
-
72
- output = Dir.chdir 'test/fixtures/cli_record_test' do
73
- `#{File.expand_path '../exe/appmap', __dir__} stats -f json -o - #{OUTPUT_FILENAME}`.strip
74
- end
75
-
76
- assert_equal 0, $CHILD_STATUS.exitstatus
77
- assert_equal <<~OUTPUT.strip, output.strip
78
- {
79
- "class_frequency": [
80
- {
81
- "name": "Main",
82
- "count": 1
83
- }
84
- ],
85
- "method_frequency": [
86
- {
87
- "name": "Main.say_hello",
88
- "count": 1
89
- }
90
- ]
91
- }
92
- OUTPUT
93
- end
94
-
95
- def test_record_to_default_location
96
- Dir.chdir 'test/fixtures/cli_record_test' do
97
- system({ 'APPMAP_FILE' => OUTPUT_FILENAME }, "#{File.expand_path '../exe/appmap', __dir__} record ./lib/cli_record_test/main.rb")
98
- end
99
-
100
- assert_equal 0, $CHILD_STATUS.exitstatus
101
- assert File.file?(OUTPUT_FILENAME), 'appmap.json does not exist'
102
- end
103
-
104
- def test_record_to_stdout
105
- output = Dir.chdir 'test/fixtures/cli_record_test' do
106
- `#{File.expand_path '../exe/appmap', __dir__} record -o - ./lib/cli_record_test/main.rb`
107
- end
108
-
109
- assert_equal 0, $CHILD_STATUS.exitstatus
110
- # Event path
111
- assert_includes output, %("path":"lib/cli_record_test/main.rb")
112
- # Function location
113
- assert_includes output, %("location":"lib/cli_record_test/main.rb:3")
114
- assert !File.file?(OUTPUT_FILENAME), "#{OUTPUT_FILENAME} should not exist"
115
- end
116
- end