[rubygems/rubygems] Make slow perf specs more stable
This seems worse to detect performance regressions, but at least should not have many false positives. https://github.com/rubygems/rubygems/commit/0b28e55415
This commit is contained in:
parent
c70052e5d9
commit
a322b2faa4
@ -11,7 +11,8 @@ RSpec.describe "bundle install with complex dependencies", realworld: true do
|
|||||||
gem "mongoid", ">= 0.10.2"
|
gem "mongoid", ">= 0.10.2"
|
||||||
G
|
G
|
||||||
|
|
||||||
expect { bundle "lock" }.to take_less_than(18) # seconds
|
bundle "lock", env: { "DEBUG_RESOLVER" => "1" }
|
||||||
|
expect(out).to include("Solution found after 1 attempts")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "resolves quickly (case 2)" do
|
it "resolves quickly (case 2)" do
|
||||||
@ -28,7 +29,8 @@ RSpec.describe "bundle install with complex dependencies", realworld: true do
|
|||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
G
|
G
|
||||||
|
|
||||||
expect { bundle "lock" }.to take_less_than(30) # seconds
|
bundle "lock", env: { "DEBUG_RESOLVER" => "1" }
|
||||||
|
expect(out).to include("Solution found after 1 attempts")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "resolves big gemfile quickly" do
|
it "resolves big gemfile quickly" do
|
||||||
@ -129,8 +131,14 @@ RSpec.describe "bundle install with complex dependencies", realworld: true do
|
|||||||
end
|
end
|
||||||
G
|
G
|
||||||
|
|
||||||
expect do
|
if Bundler.feature_flag.bundler_3_mode?
|
||||||
bundle "lock", env: { "DEBUG_RESOLVER" => "1" }, raise_on_error: !Bundler.feature_flag.bundler_3_mode?
|
bundle "lock", env: { "DEBUG_RESOLVER" => "1" }, raise_on_error: false
|
||||||
end.to take_less_than(30) # seconds
|
|
||||||
|
expect(out).to include("backtracking").exactly(26).times
|
||||||
|
else
|
||||||
|
bundle "lock", env: { "DEBUG_RESOLVER" => "1" }
|
||||||
|
|
||||||
|
expect(out).to include("Solution found after 10 attempts")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -97,32 +97,6 @@ module Spec
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec::Matchers.define :take_less_than do |seconds|
|
|
||||||
match do |actual|
|
|
||||||
start_time = Time.now
|
|
||||||
|
|
||||||
actual.call
|
|
||||||
|
|
||||||
actual_time = (Time.now - start_time).to_f
|
|
||||||
|
|
||||||
acceptable = actual_time < seconds
|
|
||||||
|
|
||||||
@errors = ["took #{actual_time} seconds"] unless acceptable
|
|
||||||
|
|
||||||
acceptable
|
|
||||||
end
|
|
||||||
|
|
||||||
failure_message do
|
|
||||||
super() + " but:\n" + @errors.map {|e| indent(e) }.join("\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
failure_message_when_negated do
|
|
||||||
super() + " but:\n" + @errors.map {|e| indent(e) }.join("\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
supports_block_expectations
|
|
||||||
end
|
|
||||||
|
|
||||||
define_compound_matcher :read_as, [exist] do |file_contents|
|
define_compound_matcher :read_as, [exist] do |file_contents|
|
||||||
diffable
|
diffable
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user