Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec run duration is wrong when using Spork #475

Closed
rymai opened this issue Oct 17, 2011 · 6 comments
Closed

Spec run duration is wrong when using Spork #475

rymai opened this issue Oct 17, 2011 · 6 comments

Comments

@rymai
Copy link

rymai commented Oct 17, 2011

Hi!

The improvement that "provide more accurate run time by registering start time before code is loaded" is great, but this (commit) cause a problem when Spork is used since the start time is set in the prefork block of Spork and duration will then be calculated from this time so it ends up in always increasing duration time.

Maybe the solution should come from Spork, like setting $rspec_start_time ||= Time.now at the top of the Spork.each_run block (as the temporary fix you gave in this guard-rspec issue?

Thanks in advance!

@dchelimsky
Copy link
Contributor

Thanks for reporting this here.

I don't think using an internal rspec global variable from spork would be a good solution. More likely I'd want something like RSpec.start_recording_time or some such. Any ideas on the name?

@timcharper - do you think it would a reasonable thing for spork to do to call RSpec.start_recording_time (or similar) at the beginning of each run?

@rymai
Copy link
Author

rymai commented Oct 17, 2011

You're right about the internal global variable! :)

Maybe RSpec.set_start_time (or RSpec.reset_start_time?) is more appropriate since it will (re)set $rspec_start_time?

@garybernhardt
Copy link
Contributor

I have a related problem, which is that I actually need the spec-only runtime. To monitor Raptor, I plot many metrics across commits, including spec runtime. I don't care about load time for this metric; I just want to know whether the specs themselves get slow.

How about this as a proposed solution to both my problem and the spork one:

  • By default, RSpec shows the spec runtime (as it was before 2.7) and the full runtime (as added in 2.7)
  • Somehow, Spork tells RSpec that it should ignore the full runtime since it doesn't make sense in that case. RSpec may be able to detect this simply based on how it's being run. For example, if Spork isn't running RSpec through its script, that should be easy to detect.

@dchelimsky
Copy link
Contributor

Alternatively, we could restore to the pre 2.7 reporting by default, and add an option to report the load time separately.

@garybernhardt
Copy link
Contributor

I was very tempted to suggest that. I'm torn because I love the idea of putting more emphasis on end-to-end runtime, but it's also nonstandard and not backwards compatible (with my metrics, for example).

@dchelimsky
Copy link
Contributor

Alterate to the previous alternative - make the option "include rspec's boot time in the time report"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants