Skip to content

Commit adb834b

Browse files
committed
Try to deal with flaky tests
We have a test that tries to test the "calibration" function in BCrypt. This function is supposed to return a "cost" based on some number of milliseconds passed in. We're trying to make the cost relative to some beginning cost (MIN_COST + 1), time that, then use it as the "relative time". The problem is that the time this takes in CI is not constant, so even `min_time_ms * 4` may fit inside the same "cost" as the original. I'm bumping the factor to `5` to hopefully reduce the flakiness. It seems like we just want to test that "some time deadline" returns a greater cos than a different time deadline, so I think bumping the factor to 5 is a legit fix
1 parent eba09de commit adb834b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎spec/bcrypt/engine_spec.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
BCrypt::Password.create("testing testing", :cost => BCrypt::Engine::MIN_COST + 1)
1818
min_time_ms = (Time.now - start_time) * 1000
1919
first = BCrypt::Engine.calibrate(min_time_ms)
20-
second = BCrypt::Engine.calibrate(min_time_ms * 4)
20+
second = BCrypt::Engine.calibrate(min_time_ms * 5)
2121
expect(second).to be > first
2222
end
2323
end

0 commit comments

Comments
 (0)