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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9762190d0d025f9e0b5667bb8c3617de492a60fe
4
- data.tar.gz: 3852d966b1245fd2c7fde01b70fef9bc7c043d86
3
+ metadata.gz: 41079cbdafd8462c82702d76fab786610669da60
4
+ data.tar.gz: f7f26e3fe1814d062ac41ac21abf7e42a1cc8c4e
5
5
  SHA512:
6
- metadata.gz: 43cfa5145f18d1bc38f3cc528c7f8e51e7663c93e4f4e2c62b5dc31ade5104a8c1cf25aa73e7d848234dd129afb709e7b08c9bc71084ab8c693433417d88818e
7
- data.tar.gz: ee033dd7afe11300842e5ac28b09672881a56b38c482db2e90f0395e2dc7e9ce447a68117a40d32140c7a21874c98dbc4eedf0dd0c9ace7488a409ea3e7a4329
6
+ metadata.gz: 0b53f5e34c216cfce23dfc4a99eb38164a0a0089c266854e3f8db3f910a0263d085171569f2e7c0a3bc2bd883145ad592e107a814079ce55ba6840020d9dc4f4
7
+ data.tar.gz: 844ea3199990935191c141ad6c6fe4186c0be5469dea517b377ea12efe7760ae41f05b2d2d6269cd44f8aa1000d2875f076a7dac4c7579d8332a130fa3169b0d
@@ -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
- logger.info `cd #{app_root} && bundle exec rake db:migrate`
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
- git.migrations_to_run_down.each do |version|
146
- logger.info "Running db:migrate:down VERSION=#{version}"
147
- logger.info `cd #{app_root} && bundle exec rake db:migrate:down VERSION=#{version}`
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
@@ -86,7 +86,7 @@ class PerfCheck
86
86
  end
87
87
 
88
88
  def bundle
89
- Bundler.with_clean_env{ exec "bundle" }
89
+ Bundler.with_original_env{ exec "bundle" }
90
90
  unless $?.success?
91
91
  logger.fatal("Problem bundling! Bailing...")
92
92
  raise BundleError
@@ -45,7 +45,7 @@ class PerfCheck
45
45
  end
46
46
 
47
47
  def mem
48
- mem = `ps -o rss= -p #{pid}`.strip.to_f / 1024
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
- system("cd #{app_root} && bundle exec rails server -b 127.0.0.1 -d -p 3031 >/dev/null")
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
@@ -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+1).times do |i|
24
+ (options.number_of_requests + 2).times do |i|
25
25
  profile = issue_request(server, options)
26
- next if i.zero? # first request just warms up the server
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 == 1
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.0
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.11
120
+ rubygems_version: 2.6.14
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: PERF CHECKKK!