Skip to content

Require 'rspec' to fix bin/rspec-stackprof

Roy Zwambag requested to merge rz-fix-bin/rspec-stackprof into master

What does this MR do and why?

bin/rspec-stackprof currently does not work because of issues with loading rspec. We add a require 'rspec' line before calling RSpec to fix this. Since require 'rspec' will also load spec_helper.rb we don't need that line anymore.

How to set up and validate locally

Run bin/rspec-stackprof followed by the path to any spec, e.g.

bin/rspec-stackprof spec/policies/ci/bridge_policy_spec.rb

This should run the spec, create a Stackprof report and save that in tmp/[filename].dump and output the report to the console.

royzwambag@Roys-MacBook-Pro gitlab % bin/rspec-stackprof spec/policies/ci/bridge_policy_spec.rb
DEPRECATION WARNING: /Users/royzwambag/work/gitlab-development-kit/gitlab/ee/app/models/ee/integration.rb:34: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/royzwambag/work/gitlab-development-kit/gitlab/app/models/integration.rb:217: warning: The called method `available_integration_names' is defined here
 (called from available_integration_names at /Users/royzwambag/work/gitlab-development-kit/gitlab/ee/app/models/ee/integration.rb:34)
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 7.688496 seconds
..

Finished in 13.6 seconds (files took 14.32 seconds to load)
2 examples, 0 failures

==================================
  Mode: wall(1000)
  Samples: 25734 (7.18% miss rate)
  GC: 2837 (11.02%)
==================================
     TOTAL    (pct)     SAMPLES    (pct)     FRAME
      6217  (24.2%)        6213  (24.1%)     GitalySetup#try_connect!
      2029   (7.9%)        2029   (7.9%)     (marking)
      1940   (7.5%)        1939   (7.5%)     Bootsnap::CompileCache::ISeq.storage_to_output
       863   (3.4%)         862   (3.3%)     Parallel.in_threads
       799   (3.1%)         799   (3.1%)     (sweeping)
       900   (3.5%)         715   (2.8%)     Mustermann::AST::Translator#decorator_for
       683   (2.7%)         444   (1.7%)     ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements#execute
       342   (1.3%)         340   (1.3%)     GitalySetup#check_gitaly_config!
       308   (1.2%)         306   (1.2%)     GraphQL::Define::InstanceDefinable#stash_dependent_methods
       493   (1.9%)         287   (1.1%)     ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_no_cache
...

Running the same command on another branch will result in an error

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Roy Zwambag

Merge request reports