perf_check 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perf_check.rb +9 -5
- data/lib/perf_check/git.rb +1 -1
- data/lib/perf_check/server.rb +6 -2
- data/lib/perf_check/test_case.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41079cbdafd8462c82702d76fab786610669da60
|
4
|
+
data.tar.gz: f7f26e3fe1814d062ac41ac21abf7e42a1cc8c4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b53f5e34c216cfce23dfc4a99eb38164a0a0089c266854e3f8db3f910a0263d085171569f2e7c0a3bc2bd883145ad592e107a814079ce55ba6840020d9dc4f4
|
7
|
+
data.tar.gz: 844ea3199990935191c141ad6c6fe4186c0be5469dea517b377ea12efe7760ae41f05b2d2d6269cd44f8aa1000d2875f076a7dac4c7579d8332a130fa3169b0d
|
data/lib/perf_check.rb
CHANGED
@@ -15,7 +15,6 @@ class PerfCheck
|
|
15
15
|
|
16
16
|
def initialize(app_root)
|
17
17
|
@app_root = app_root
|
18
|
-
|
19
18
|
@options = OpenStruct.new(
|
20
19
|
number_of_requests: 20,
|
21
20
|
reference: 'master',
|
@@ -44,6 +43,7 @@ class PerfCheck
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def load_config
|
46
|
+
File.stat(File.join(app_root,'Gemfile')).file?
|
47
47
|
if File.exists?("#{app_root}/config/perf_check.rb")
|
48
48
|
this = self
|
49
49
|
Kernel.send(:define_method, :perf_check){ this }
|
@@ -137,14 +137,18 @@ class PerfCheck
|
|
137
137
|
|
138
138
|
def run_migrations_up
|
139
139
|
logger.info "Running db:migrate"
|
140
|
-
|
140
|
+
Bundler.with_original_env do
|
141
|
+
logger.info `cd #{app_root} && bundle exec rake db:migrate`
|
142
|
+
end
|
141
143
|
git.clean_db
|
142
144
|
end
|
143
145
|
|
144
146
|
def run_migrations_down
|
145
|
-
|
146
|
-
|
147
|
-
|
147
|
+
Bundler.with_original_env do
|
148
|
+
git.migrations_to_run_down.each do |version|
|
149
|
+
logger.info "Running db:migrate:down VERSION=#{version}"
|
150
|
+
logger.info `cd #{app_root} && bundle exec rake db:migrate:down VERSION=#{version}`
|
151
|
+
end
|
148
152
|
end
|
149
153
|
git.clean_db
|
150
154
|
end
|
data/lib/perf_check/git.rb
CHANGED
data/lib/perf_check/server.rb
CHANGED
@@ -45,7 +45,7 @@ class PerfCheck
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def mem
|
48
|
-
|
48
|
+
`ps -o rss= -p #{pid}`.strip.to_f / 1024
|
49
49
|
end
|
50
50
|
|
51
51
|
def prepare_to_profile
|
@@ -111,7 +111,11 @@ class PerfCheck
|
|
111
111
|
end
|
112
112
|
|
113
113
|
app_root = Shellwords.shellescape(perf_check.app_root)
|
114
|
-
|
114
|
+
Bundler.with_clean_env do
|
115
|
+
Dir.chdir app_root do
|
116
|
+
`bundle exec rails server -b 127.0.0.1 -d -p 3031 >/dev/null`
|
117
|
+
end
|
118
|
+
end
|
115
119
|
sleep(1.5)
|
116
120
|
|
117
121
|
@running = true
|
data/lib/perf_check/test_case.rb
CHANGED
@@ -21,11 +21,11 @@ class PerfCheck
|
|
21
21
|
perf_check.logger.info("\t"+['request', 'latency', 'server rss', 'status', 'queries', 'profiler data'].map(&:underline).join(" "))
|
22
22
|
end
|
23
23
|
|
24
|
-
(options.number_of_requests+
|
24
|
+
(options.number_of_requests + 2).times do |i|
|
25
25
|
profile = issue_request(server, options)
|
26
|
-
next if i
|
26
|
+
next if i < 2 # first 2 requests warm up the server/db and get tossed
|
27
27
|
|
28
|
-
if options.verify_no_diff && i ==
|
28
|
+
if options.verify_no_diff && i == 2
|
29
29
|
response_for_comparison(profile.response_body)
|
30
30
|
end
|
31
31
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perf_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rubytune
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.6.
|
120
|
+
rubygems_version: 2.6.14
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: PERF CHECKKK!
|