appmap 0.78.0 → 0.79.0
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 +4 -16
- data/CHANGELOG.md +7 -0
- data/{spec/fixtures/rails5_users_app/Dockerfile.pg → Dockerfile.pg} +0 -0
- data/README.md +14 -44
- data/README_CI.md +0 -7
- data/Rakefile +12 -150
- data/appmap.gemspec +3 -2
- data/docker-compose.yml +10 -0
- data/lib/appmap/version.rb +1 -1
- data/spec/config_spec.rb +1 -1
- data/spec/depends/api_spec.rb +13 -5
- data/spec/depends/spec_helper.rb +0 -9
- data/spec/fixtures/database.yml +11 -0
- data/spec/fixtures/rails5_users_app/config/database.yml +1 -0
- data/spec/fixtures/rails6_users_app/Gemfile +1 -25
- data/spec/fixtures/rails6_users_app/config/database.yml +1 -0
- data/spec/fixtures/rails7_users_app/Gemfile +1 -25
- data/spec/fixtures/rails7_users_app/config/database.yml +1 -0
- data/spec/hook_spec.rb +1 -1
- data/spec/rails_recording_spec.rb +4 -20
- data/spec/rails_spec_helper.rb +76 -63
- data/spec/rails_test_spec.rb +7 -17
- data/spec/railtie_spec.rb +4 -18
- data/spec/record_sql_rails_pg_spec.rb +44 -75
- data/spec/remote_recording_spec.rb +18 -30
- data/spec/spec_helper.rb +1 -0
- data/spec/swagger/swagger_spec.rb +1 -16
- data/spec/util_spec.rb +1 -1
- metadata +21 -21
- data/Dockerfile.appmap +0 -5
- data/spec/fixtures/rack_users_app/Dockerfile +0 -32
- data/spec/fixtures/rack_users_app/docker-compose.yml +0 -9
- data/spec/fixtures/rails5_users_app/Dockerfile +0 -29
- data/spec/fixtures/rails5_users_app/config/database.yml +0 -18
- data/spec/fixtures/rails5_users_app/create_app +0 -33
- data/spec/fixtures/rails5_users_app/docker-compose.yml +0 -31
- data/spec/fixtures/rails6_users_app/.ruby-version +0 -1
- data/spec/fixtures/rails6_users_app/Dockerfile +0 -44
- data/spec/fixtures/rails6_users_app/Dockerfile.pg +0 -3
- data/spec/fixtures/rails6_users_app/config/database.yml +0 -18
- data/spec/fixtures/rails6_users_app/create_app +0 -33
- data/spec/fixtures/rails6_users_app/docker-compose.yml +0 -31
- data/spec/fixtures/rails7_users_app/.ruby-version +0 -1
- data/spec/fixtures/rails7_users_app/Dockerfile +0 -30
- data/spec/fixtures/rails7_users_app/Dockerfile.pg +0 -3
- data/spec/fixtures/rails7_users_app/config/database.yml +0 -86
- data/spec/fixtures/rails7_users_app/create_app +0 -31
- data/spec/fixtures/rails7_users_app/docker-compose.yml +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5c6a40273c5606504492f151b2feeb1addc83d92f6bec7a80ca51d3034cd79f
|
4
|
+
data.tar.gz: b10a582926396930d2a980cd4323bd83f7c3444aa0b77bf2dd2dfa632203f65d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f56a49c05561a74ae2ee7512fbad2beadc1a0aa719e27b455ea330777c58e97b7c028f7eaaee13d52f20c8ace6bf9284ff8c717e17d922a45f2dca703781a737
|
7
|
+
data.tar.gz: d35ac177b2b12ddd4f4e0517ed4101043c8e9d29f89f53721969d45e3e2be293ae7ad0b8466a2fae63329bb7a13e27d699b30a2464a663014d04a71a8d464293
|
data/.travis.yml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
language: ruby
|
2
2
|
dist: bionic
|
3
|
+
cache:
|
4
|
+
- bundle
|
5
|
+
- yarn
|
3
6
|
|
4
7
|
# NB: if you update the ruby versions here, you also need to update
|
5
8
|
# them in the Rakefile.
|
@@ -9,25 +12,10 @@ rbenv:
|
|
9
12
|
- 3.0
|
10
13
|
- 3.1
|
11
14
|
|
12
|
-
addons:
|
13
|
-
apt:
|
14
|
-
packages:
|
15
|
-
# https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
|
16
|
-
- docker-ce
|
17
|
-
|
18
15
|
services:
|
19
|
-
-
|
16
|
+
- postgresql
|
20
17
|
|
21
18
|
before_install:
|
22
|
-
- sudo apt-get update && sudo apt-get install apt-transport-https ca-certificates -y && sudo update-ca-certificates
|
23
|
-
# see https://blog.travis-ci.com/docker-rate-limits
|
24
|
-
# and also https://www.docker.com/blog/what-you-need-to-know-about-upcoming-docker-hub-rate-limiting/
|
25
|
-
# if we do not use authorized account,
|
26
|
-
# the pulls-per-IP quota is shared with other Travis users
|
27
|
-
- >
|
28
|
-
if [ ! -z "$DOCKERHUB_PASSWORD" ] && [ ! -z "$DOCKERHUB_USERNAME" ]; then
|
29
|
-
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin ;
|
30
|
-
fi
|
31
19
|
- |
|
32
20
|
nvm install --lts \
|
33
21
|
&& nvm use --lts \
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.79.0](https://github.com/applandinc/appmap-ruby/compare/v0.78.0...v0.79.0) (2022-04-06)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Use a more unique test database name ([0eed036](https://github.com/applandinc/appmap-ruby/commit/0eed036460f0384698ff91c1112a4a9c3214f7f4))
|
7
|
+
|
1
8
|
# [0.78.0](https://github.com/applandinc/appmap-ruby/compare/v0.77.4...v0.78.0) (2022-04-04)
|
2
9
|
|
3
10
|
|
File without changes
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Visit the [AppMap for Ruby](https://appland.com/docs/reference/appmap-ruby.html)
|
|
28
28
|
|
29
29
|
**Configuration**
|
30
30
|
|
31
|
-
*appmap.yml* is loaded into an `AppMap::Config`.
|
31
|
+
*appmap.yml* is loaded into an `AppMap::Config`.
|
32
32
|
|
33
33
|
**Hooking**
|
34
34
|
|
@@ -39,7 +39,7 @@ method with calls that record the parameters and return value.
|
|
39
39
|
**Builtins**
|
40
40
|
|
41
41
|
`Hook` begins by iterating over builtin classes and modules defined in the `Config`. Builtins include code
|
42
|
-
like `openssl` and `net/http`. This code is not dependent on any external libraries being present, and
|
42
|
+
like `openssl` and `net/http`. This code is not dependent on any external libraries being present, and
|
43
43
|
`appmap` cannot guarantee that it will be loaded before builtins. Therefore, it's necessary to require it and
|
44
44
|
hook it by looking up the classes and modules as constants in the `Object` namespace.
|
45
45
|
|
@@ -81,50 +81,20 @@ The fixture apps in `test/fixtures` are plain Ruby projects that exercise the ba
|
|
81
81
|
|
82
82
|
The fixture apps in `spec/fixtures` are simple Rack, Rails5, and Rails6 apps.
|
83
83
|
You can use them to interactively develop and test the recording features of the `appmap` gem.
|
84
|
-
These fixture apps are more sophisticated than `test/fixtures`, because they include additional
|
85
|
-
resources such as a PostgreSQL database.
|
84
|
+
These fixture apps are more sophisticated than `test/fixtures`, because they include additional
|
85
|
+
resources such as a PostgreSQL database. Still, you can simply enter the fixture directory and `bundle`.
|
86
86
|
|
87
|
-
|
87
|
+
If you don't have PostgreSQL on the local (default) socket, you can export `DATABASE_URL` to
|
88
|
+
point to the database server you want to use.
|
88
89
|
|
89
|
-
|
90
|
-
$ bundle exec rake build:fixtures:all
|
91
|
-
```
|
92
|
-
|
93
|
-
This will build the `appmap.gem`, along with a Docker image for each fixture app.
|
94
|
-
|
95
|
-
Then move to the directory of the fixture you want to use, and provision the environment.
|
96
|
-
In this example, we use Ruby 2.6.
|
97
|
-
|
98
|
-
```sh-session
|
99
|
-
$ export RUBY_VERSION=2.6
|
100
|
-
$ docker-compose up -d pg
|
101
|
-
$ sleep 10s # Or some reasonable amount of time
|
102
|
-
$ docker-compose run --rm app ./create_app
|
103
|
-
```
|
90
|
+
You can launch a database like this:
|
104
91
|
|
105
|
-
Now you can start a development container.
|
106
|
-
|
107
|
-
```sh-session
|
108
|
-
$ docker-compose run --rm -v $PWD:/app -v $PWD/../../..:/src/appmap-ruby app bash
|
109
|
-
Starting rails_users_app_pg_1 ... done
|
110
|
-
root@6fab5f89125f:/app# cd /src/appmap-ruby
|
111
|
-
root@6fab5f89125f:/src/appmap-ruby# rm ext/appmap/*.so ext/appmap/*.o
|
112
|
-
root@6fab5f89125f:/src/appmap-ruby# bundle
|
113
|
-
root@6fab5f89125f:/src/appmap-ruby# bundle exec rake compile
|
114
|
-
root@6fab5f89125f:/src/appmap-ruby# cd /src/app
|
115
|
-
root@6fab5f89125f:/src/app# bundle config local.appmap /src/appmap-ruby
|
116
|
-
root@6fab5f89125f:/src/app# bundle
|
117
92
|
```
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
Configuring AppMap from path appmap.yml
|
126
|
-
....
|
127
|
-
|
128
|
-
Finished in 0.07357 seconds (files took 2.1 seconds to load)
|
129
|
-
4 examples, 0 failures
|
93
|
+
➜ docker-compose -p appmap-ruby up -d
|
94
|
+
... stuff
|
95
|
+
➜ docker-compose ps pg
|
96
|
+
Name Command State Ports
|
97
|
+
-----------------------------------------------------------------------------------------
|
98
|
+
appmap-ruby_pg_1 docker-entrypoint.sh postgres Up (healthy) 0.0.0.0:59134->5432/tcp
|
99
|
+
➜ export DATABASE_URL=postgres://postgres@localhost:59134
|
130
100
|
```
|
data/README_CI.md
CHANGED
@@ -4,13 +4,6 @@
|
|
4
4
|
* `GEM_HOST_API_KEY`: rubygems API key
|
5
5
|
* `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows,
|
6
6
|
to avoid publication of test releases under official package name
|
7
|
-
* `DOCKERHUB\_USERNAME`, `DOCKERHUB_PASSWORD`: optional dockerhub credentials,
|
8
|
-
to avoid throttling of dockerhub anonymous pulls
|
9
|
-
|
10
|
-
Note: for security reasons, it's better to use dedicated (not personal)
|
11
|
-
Dockerhub account,
|
12
|
-
and also use [access tokens](https://docs.docker.com/docker-hub/access-tokens/)
|
13
|
-
instead of primary password
|
14
7
|
|
15
8
|
# Release command
|
16
9
|
|
data/Rakefile
CHANGED
@@ -1,26 +1,8 @@
|
|
1
1
|
$: << File.join(__dir__, 'lib')
|
2
|
-
require 'appmap/version'
|
3
|
-
GEM_VERSION = AppMap::VERSION
|
4
|
-
|
5
|
-
# Make sure the local version is not behind the one on
|
6
|
-
# rubygems.org (it's ok if they're the same).
|
7
|
-
#
|
8
|
-
# If it is behind, the fixture images won't get updated with the gem
|
9
|
-
# built from the local source, so you'll wind up testing the rubygems
|
10
|
-
# version instead.
|
11
|
-
unless ENV['SKIP_VERSION_CHECK']
|
12
|
-
require 'json'
|
13
|
-
require 'net/http'
|
14
|
-
rubygems_version = JSON.parse(Net::HTTP.get(URI.parse('https://rubygems.org/api/v1/gems/appmap.json')))['version']
|
15
|
-
if Gem::Version.new(GEM_VERSION) < Gem::Version.new(rubygems_version)
|
16
|
-
raise "#{GEM_VERSION} < #{rubygems_version}. Rebase to avoid build issues."
|
17
|
-
end
|
18
|
-
end
|
19
2
|
|
3
|
+
require 'rspec/core/rake_task'
|
20
4
|
require 'rake/testtask'
|
21
5
|
require 'rdoc/task'
|
22
|
-
|
23
|
-
require 'open3'
|
24
6
|
require 'rake/extensiontask'
|
25
7
|
|
26
8
|
desc 'build the native extension'
|
@@ -28,138 +10,20 @@ Rake::ExtensionTask.new("appmap") do |ext|
|
|
28
10
|
ext.lib_dir = "lib/appmap"
|
29
11
|
end
|
30
12
|
|
31
|
-
RUBY_VERSIONS=%w[2.6 2.7 3.0 3.1].select do |version|
|
32
|
-
travis_ruby_version = ENV['TRAVIS_RUBY_VERSION']
|
33
|
-
next true unless travis_ruby_version
|
34
|
-
|
35
|
-
if travis_ruby_version.index(version) == 0
|
36
|
-
warn "Testing Ruby version #{version}, since it matches TRAVIS_RUBY_VERSION=#{travis_ruby_version}"
|
37
|
-
next true
|
38
|
-
end
|
39
|
-
|
40
|
-
false
|
41
|
-
end
|
42
|
-
FIXTURE_APPS=[:rack_users_app, :rails6_users_app, :rails5_users_app, :rails7_users_app => {:ruby_version => '>= 2.7'}]
|
43
|
-
|
44
|
-
def run_cmd(*cmd)
|
45
|
-
$stderr.puts "Running: #{cmd}"
|
46
|
-
out, s = Open3.capture2e(*cmd)
|
47
|
-
unless s.success?
|
48
|
-
$stderr.puts <<-END
|
49
|
-
Command failed:
|
50
|
-
<<< Output:
|
51
|
-
#{out}
|
52
|
-
>>> End of output
|
53
|
-
END
|
54
|
-
raise 'Docker build failed'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def build_base_image(ruby_version)
|
59
|
-
run_cmd "docker build" \
|
60
|
-
" --build-arg RUBY_VERSION=#{ruby_version}" \
|
61
|
-
" --build-arg GEM_VERSION=#{GEM_VERSION}" \
|
62
|
-
" -t appmap:#{GEM_VERSION} -f Dockerfile.appmap ."
|
63
|
-
end
|
64
|
-
|
65
|
-
def build_app_image(app, ruby_version)
|
66
|
-
Dir.chdir "spec/fixtures/#{app}" do
|
67
|
-
env = {"RUBY_VERSION" => ruby_version, "GEM_VERSION" => GEM_VERSION}
|
68
|
-
run_cmd(env,
|
69
|
-
"docker-compose build" \
|
70
|
-
" --build-arg RUBY_VERSION=#{ruby_version}" \
|
71
|
-
" --build-arg GEM_VERSION=#{GEM_VERSION}" )
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
13
|
desc 'Install non-Ruby dependencies'
|
76
14
|
task :install do
|
77
15
|
system 'yarn install' or raise 'yarn install failed'
|
78
16
|
end
|
79
17
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
build_base_image(ruby_version)
|
90
|
-
end.tap do |t|
|
91
|
-
desc "Build all images"
|
92
|
-
task all: t
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
namespace :fixtures do
|
98
|
-
RUBY_VERSIONS.each do |ruby_version|
|
99
|
-
namespace ruby_version do
|
100
|
-
desc "build:fixtures:#{ruby_version}"
|
101
|
-
FIXTURE_APPS.each do |app_spec|
|
102
|
-
app = if app_spec.instance_of?(Hash)
|
103
|
-
app_spec = app_spec.flatten
|
104
|
-
version_rqt = Gem::Requirement.create(app_spec[1][:ruby_version])
|
105
|
-
next unless version_rqt =~ (Gem::Version.new(ruby_version))
|
106
|
-
app = app_spec[0]
|
107
|
-
else
|
108
|
-
app = app_spec
|
109
|
-
end.to_s
|
110
|
-
|
111
|
-
|
112
|
-
desc app
|
113
|
-
task app => ["base:#{ruby_version}"] do
|
114
|
-
build_app_image(app, ruby_version)
|
115
|
-
end.tap do |t|
|
116
|
-
desc "Build all fixture images for #{ruby_version}"
|
117
|
-
task all: t
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
desc "Build all fixture images"
|
123
|
-
task all: ["#{ruby_version}:all"]
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
task all: ["fixtures:all"]
|
128
|
-
end
|
129
|
-
|
130
|
-
def run_specs(ruby_version, task_args)
|
131
|
-
require 'rspec/core/rake_task'
|
132
|
-
require 'climate_control'
|
133
|
-
# Define an rspec rake task for the specified Ruby version. It's hidden (i.e. doesn't have a
|
134
|
-
# description), because it's not intended to be invoked directly
|
135
|
-
RSpec::Core::RakeTask.new("rspec_#{ruby_version}", [:specs]) do |task, args|
|
136
|
-
task.exclude_pattern = 'spec/fixtures/**/*_spec.rb'
|
137
|
-
task.rspec_opts = '-f doc'
|
138
|
-
if args.count > 0
|
139
|
-
# There doesn't appear to be a value for +pattern+ that will
|
140
|
-
# cause it to be ignored. Setting it to '' or +nil+ causes an
|
141
|
-
# empty argument to get passed to rspec, which confuses it.
|
142
|
-
task.pattern = 'never match this'
|
143
|
-
task.rspec_opts += " " + args.to_a.join(' ')
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
# Set up the environment, then execute the rspec task we
|
148
|
-
# created above.
|
149
|
-
ClimateControl.modify(RUBY_VERSION: ruby_version) do
|
150
|
-
Rake::Task["rspec_#{ruby_version}"].execute(task_args)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
namespace :spec do
|
155
|
-
RUBY_VERSIONS.each do |ruby_version|
|
156
|
-
desc ruby_version
|
157
|
-
task ruby_version, [:specs] => ["install", "compile", "build:fixtures:#{ruby_version}:all"] do |_, task_args|
|
158
|
-
run_specs(ruby_version, task_args)
|
159
|
-
end.tap do |t|
|
160
|
-
desc "Run all specs"
|
161
|
-
task :all, [:specs] => t
|
162
|
-
end
|
18
|
+
RSpec::Core::RakeTask.new spec: %i[compile install] do |task, args|
|
19
|
+
task.exclude_pattern = 'spec/fixtures/**/*_spec.rb'
|
20
|
+
task.rspec_opts = '-f doc'
|
21
|
+
if args.count > 0
|
22
|
+
# There doesn't appear to be a value for +pattern+ that will
|
23
|
+
# cause it to be ignored. Setting it to '' or +nil+ causes an
|
24
|
+
# empty argument to get passed to rspec, which confuses it.
|
25
|
+
task.pattern = 'never match this'
|
26
|
+
task.rspec_opts += [nil, *args].join(' ')
|
163
27
|
end
|
164
28
|
end
|
165
29
|
|
@@ -169,14 +33,12 @@ Rake::RDocTask.new do |rd|
|
|
169
33
|
rd.title = 'AppMap'
|
170
34
|
end
|
171
35
|
|
172
|
-
Rake::TestTask.new(minitest:
|
36
|
+
Rake::TestTask.new(minitest: :compile) do |t|
|
173
37
|
t.libs << 'test'
|
174
38
|
t.libs << 'lib'
|
175
39
|
t.test_files = FileList['test/*_test.rb']
|
176
40
|
end
|
177
41
|
|
178
|
-
task
|
179
|
-
|
180
|
-
task test: %i[spec:all minitest]
|
42
|
+
task test: %i[spec minitest]
|
181
43
|
|
182
44
|
task default: :test
|
data/appmap.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'appmap/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
# ability to parameterize gem name is added intentionally,
|
8
|
+
# ability to parameterize gem name is added intentionally,
|
9
9
|
# to support the possibility of unofficial releases, e.g. during CI tests
|
10
10
|
spec.name = (ENV['GEM_ALTERNATIVE_NAME'].to_s.empty? ? 'appmap' : ENV["GEM_ALTERNATIVE_NAME"] )
|
11
11
|
spec.version = AppMap::VERSION
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency 'reverse_markdown'
|
33
33
|
|
34
34
|
spec.add_development_dependency 'bundler', '>= 1.16'
|
35
|
-
spec.add_development_dependency 'minitest', '~> 5.
|
35
|
+
spec.add_development_dependency 'minitest', '~> 5.15'
|
36
36
|
spec.add_development_dependency 'pry-byebug'
|
37
37
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
38
38
|
spec.add_development_dependency 'rdoc'
|
@@ -48,5 +48,6 @@ Gem::Specification.new do |spec|
|
|
48
48
|
spec.add_development_dependency 'webdrivers', '~> 4.0'
|
49
49
|
spec.add_development_dependency 'timecop'
|
50
50
|
spec.add_development_dependency 'hashie'
|
51
|
+
spec.add_development_dependency 'random-port', '~> 0.5.1'
|
51
52
|
spec.add_development_dependency 'webrick'
|
52
53
|
end
|
data/docker-compose.yml
ADDED
data/lib/appmap/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
data/spec/depends/api_spec.rb
CHANGED
@@ -33,7 +33,7 @@ module AppMap
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
37
37
|
|
38
38
|
describe 'Depends API' do
|
39
39
|
let(:api) { AppMap::Depends::API.new(ENV['DEBUG'] == 'true') }
|
@@ -112,12 +112,12 @@ describe 'Depends API' do
|
|
112
112
|
around do |test|
|
113
113
|
@minitest_test_command_method = AppMap.configuration.depends_config.minitest_test_command_method
|
114
114
|
AppMap.configuration.depends_config.minitest_test_command_method = 'AppMap::Depends::APISpec.minitest_test_command'
|
115
|
-
|
115
|
+
|
116
116
|
test.call
|
117
117
|
ensure
|
118
118
|
AppMap.configuration.depends_config.minitest_test_command_method = @minitest_test_command
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
it 'passes a smoke test' do
|
122
122
|
run_tests
|
123
123
|
end
|
@@ -175,10 +175,18 @@ describe 'Depends API' do
|
|
175
175
|
# At this point, we would run tests to bring the AppMaps up to date
|
176
176
|
# Then once the tests have finished, remove any AppMaps that weren't refreshed
|
177
177
|
removed = api.remove_out_of_date_appmaps(since, appmap_dir: DEPENDS_TEST_DIR, base_dir: DEPENDS_BASE_DIR)
|
178
|
-
expect(removed).to eq([ appmap_path.split('.')[0] ])
|
178
|
+
expect(removed).to eq([ appmap_path.split('.')[0] ])
|
179
179
|
ensure
|
180
|
-
File.write(appmap_path, appmap)
|
180
|
+
File.write(appmap_path, appmap)
|
181
181
|
end
|
182
182
|
end
|
183
183
|
end
|
184
|
+
|
185
|
+
before do
|
186
|
+
Dir.glob("#{DEPENDS_TEST_DIR}/*.appmap.json").each { |fname| FileUtils.touch fname }
|
187
|
+
update_appmap_index
|
188
|
+
|
189
|
+
FileUtils.rm_rf 'spec/tmp'
|
190
|
+
FileUtils.mkdir_p 'spec/tmp'
|
191
|
+
end
|
184
192
|
end
|
data/spec/depends/spec_helper.rb
CHANGED
@@ -16,12 +16,3 @@ def update_appmap_index
|
|
16
16
|
system cmd.join(' ') or raise "Failed to update AppMap index in #{DEPENDS_TEST_DIR}"
|
17
17
|
end
|
18
18
|
|
19
|
-
RSpec.configure do |rspec|
|
20
|
-
rspec.before do
|
21
|
-
Dir.glob("#{DEPENDS_TEST_DIR}/*.appmap.json").each { |fname| FileUtils.touch fname }
|
22
|
-
update_appmap_index
|
23
|
-
|
24
|
-
FileUtils.rm_rf 'spec/tmp'
|
25
|
-
FileUtils.mkdir_p 'spec/tmp'
|
26
|
-
end
|
27
|
-
end
|
@@ -0,0 +1 @@
|
|
1
|
+
../../database.yml
|
@@ -11,32 +11,8 @@ gem 'sequel', '>= 5.43.0', require: false
|
|
11
11
|
gem 'sequel-rails', require: false
|
12
12
|
gem 'sequel_secure_password', require: false
|
13
13
|
|
14
|
-
appmap_path = \
|
15
|
-
# Support debugging inside the container with volume-mounted source
|
16
|
-
if File.directory?('/src/appmap-ruby')
|
17
|
-
'/src/appmap-ruby'
|
18
|
-
elsif File.exist?('../../../appmap.gemspec')
|
19
|
-
'../../..'
|
20
|
-
end
|
21
|
-
|
22
|
-
if appmap_path
|
23
|
-
# Set the branch parameter, so that 'bundle config local.appmap' will work
|
24
|
-
appmap_branch = Dir.chdir appmap_path do
|
25
|
-
`git rev-parse --abbrev-ref HEAD`.strip
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
appmap_options = \
|
30
|
-
if appmap_path && appmap_branch
|
31
|
-
{ git: appmap_path, branch: appmap_branch }
|
32
|
-
elsif appmap_path
|
33
|
-
{ path: appmap_path }
|
34
|
-
else
|
35
|
-
{}
|
36
|
-
end.merge(require: %w[appmap])
|
37
|
-
|
38
14
|
group :development, :test do
|
39
|
-
gem 'appmap',
|
15
|
+
gem 'appmap', path: '../../..'
|
40
16
|
gem 'cucumber-rails', require: false
|
41
17
|
gem 'rspec-rails'
|
42
18
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
@@ -0,0 +1 @@
|
|
1
|
+
../../database.yml
|
@@ -69,31 +69,7 @@ group :test do
|
|
69
69
|
gem "webdrivers"
|
70
70
|
end
|
71
71
|
|
72
|
-
appmap_path = \
|
73
|
-
# Support debugging inside the container with volume-mounted source
|
74
|
-
if File.directory?('/src/appmap-ruby')
|
75
|
-
'/src/appmap-ruby'
|
76
|
-
elsif File.exist?('../../../appmap.gemspec')
|
77
|
-
'../../..'
|
78
|
-
end
|
79
|
-
|
80
|
-
if appmap_path
|
81
|
-
# Set the branch parameter, so that 'bundle config local.appmap' will work
|
82
|
-
appmap_branch = Dir.chdir appmap_path do
|
83
|
-
`git rev-parse --abbrev-ref HEAD`.strip
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
appmap_options = \
|
88
|
-
if appmap_path && appmap_branch
|
89
|
-
{ git: appmap_path, branch: appmap_branch }
|
90
|
-
elsif appmap_path
|
91
|
-
{ path: appmap_path }
|
92
|
-
else
|
93
|
-
{}
|
94
|
-
end.merge(require: %w[appmap])
|
95
|
-
|
96
72
|
group :development, :test do
|
97
|
-
gem 'appmap',
|
73
|
+
gem 'appmap', path: '../../..'
|
98
74
|
gem 'pry-byebug', '>=0', '< 99'
|
99
75
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
../../database.yml
|
data/spec/hook_spec.rb
CHANGED
@@ -16,7 +16,7 @@ module ShowYamlNulls
|
|
16
16
|
end
|
17
17
|
Psych::Visitors::YAMLTree.prepend(ShowYamlNulls)
|
18
18
|
|
19
|
-
describe 'AppMap class Hooking'
|
19
|
+
describe 'AppMap class Hooking' do
|
20
20
|
include_context 'collect events'
|
21
21
|
|
22
22
|
def invoke_test_file(file, setup: nil, packages: nil)
|
@@ -15,14 +15,6 @@ describe 'Rails' do
|
|
15
15
|
include_context 'Rails app pg database', "spec/fixtures/rails#{rails_major_version}_users_app" unless use_existing_data?
|
16
16
|
include_context 'rails integration test setup'
|
17
17
|
|
18
|
-
def run_spec(spec_name)
|
19
|
-
cmd = <<~CMD.gsub "\n", ' '
|
20
|
-
docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true
|
21
|
-
-v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec #{spec_name}
|
22
|
-
CMD
|
23
|
-
run_cmd cmd, chdir: fixture_dir
|
24
|
-
end
|
25
|
-
|
26
18
|
describe 'an API route' do
|
27
19
|
describe 'creating an object' do
|
28
20
|
let(:appmap_json_file) do
|
@@ -123,7 +115,7 @@ describe 'Rails' do
|
|
123
115
|
)
|
124
116
|
)
|
125
117
|
)
|
126
|
-
)
|
118
|
+
)
|
127
119
|
end
|
128
120
|
end
|
129
121
|
end
|
@@ -201,7 +193,7 @@ describe 'Rails' do
|
|
201
193
|
'path_info' => '/users/alice',
|
202
194
|
'normalized_path_info' => '/users/{id}',
|
203
195
|
'headers' => {
|
204
|
-
'Host' => 'test.host',
|
196
|
+
'Host' => 'test.host',
|
205
197
|
'User-Agent' => 'Rails Testing'
|
206
198
|
}
|
207
199
|
}
|
@@ -236,7 +228,7 @@ describe 'Rails' do
|
|
236
228
|
'defined_class' => 'inline_template',
|
237
229
|
'method_id' => 'render'
|
238
230
|
)
|
239
|
-
|
231
|
+
|
240
232
|
expect(appmap['classMap']).to include hash_including(
|
241
233
|
'name' => 'actionview',
|
242
234
|
'children' => include(hash_including(
|
@@ -251,7 +243,7 @@ describe 'Rails' do
|
|
251
243
|
))
|
252
244
|
))
|
253
245
|
)
|
254
|
-
end
|
246
|
+
end
|
255
247
|
end
|
256
248
|
end
|
257
249
|
end
|
@@ -261,14 +253,6 @@ describe 'Rails' do
|
|
261
253
|
include_context 'Rails app pg database', "spec/fixtures/rails6_users_app" unless use_existing_data?
|
262
254
|
include_context 'rails integration test setup'
|
263
255
|
|
264
|
-
def run_spec(spec_name)
|
265
|
-
cmd = <<~CMD.gsub "\n", ' '
|
266
|
-
docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true -e APPMAP_CONFIG_FILE=no/such/file
|
267
|
-
-v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec #{spec_name}
|
268
|
-
CMD
|
269
|
-
run_cmd cmd, chdir: fixture_dir
|
270
|
-
end
|
271
|
-
|
272
256
|
let(:appmap_json_file) do
|
273
257
|
'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user.appmap.json'
|
274
258
|
end
|