Closed bibendi closed 1 year ago
Thanks for the issue. Sounds reasonable! Though I do think if using time travel helpers, you should make sure time is restored, I believe this formatter might not be the only one that get's affected by such issues 😄
you should make sure time is restored
Definitely! We have already fixed them :)
I read through the article and it actually seems, that monotonic
clock is not very useful in this situation. We don't need to get elapsed time but rather epoch timestamp.
There is a constant that allows to do that, CLOCK_REALTIME
, but even ruby documentation suggest to use Time.now
over it.
Closing this, it doesn't seem that monotonic clock is at all usable in scenario when one needs to get current epoch timestamp.
Given that Time.now
happens in formatter which always happens outside of rspec context, I consider that users should make sure to reset time traveling in the scenario.
https://github.com/allure-framework/allure-ruby/blob/65a21c2fc63e2b71eab676ca56f3f99400962ff0/allure-ruby-commons/lib/allure_ruby_commons/result_utils.rb#L35
Hi!
We have faced a problem in our RSpec tests when someone try to travel in time and then forgot to travel back. I mean these helpers https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html
Also there is another good reason not to use
Time.now
to get elapsed time https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/