diff options
author | Stan Hu <stanhu@gmail.com> | 2017-05-24 17:27:04 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-05-24 20:22:41 -0700 |
commit | 72378f3aa081a45cb782ac91368cb8844c3f992a (patch) | |
tree | 29e3eeef672dba7083c6c0ed02ab9a1ec11d8da4 | |
parent | d893b8970a9c4a1475683953a89a56f9e603cdd2 (diff) | |
download | gitlab-ce-sh-test-spec-fix2.tar.gz |
Do some memory profiling to diagnose memory spec failuressh-test-spec-fix2
-rw-r--r-- | spec/spec_helper.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 51571ddebe9..71985075eba 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -76,6 +76,24 @@ RSpec.configure do |config| end end + def get_rss + output, status = Gitlab::Popen.popen(%W(ps -o rss= -p #{Process.pid})) + return 0 unless status.zero? + + output.to_i + end + + def get_phantomjs_rss + output, status = Gitlab::Popen.popen(%W(ps -o rss= -C phantomjs)) + return 0 unless status.zero? + + output.to_i + end + + config.before(:all) do |group| + puts "Working on #{group}: RSS is #{get_rss} #{get_phantomjs_rss}" + end + config.around(:each, :caching) do |example| caching_store = Rails.cache Rails.cache = ActiveSupport::Cache::MemoryStore.new if example.metadata[:caching] |