EventProf Minitest integration #29
Conversation
…for factory.create
Great job There are some small issues but overall looks good. Thank you! Don't forget about:
|
opts.on "--event-prof=EVENT", "Collects metrics for specified EVENT" do |event| | ||
options[:event] = event | ||
end | ||
opts.on "--event-prof-rank=RANK_BY", "Defines RANK_BY parameter for results" do |rank| |
palkan
Sep 29, 2017
Collaborator
Let's name it --event-prof-rank-by
making more readable
Let's name it --event-prof-rank-by
making more readable
|
||
def location(group, example) | ||
name = group.public_instance_methods(false).find { |mtd| mtd.to_s == example } | ||
group.instance_method(name).source_location |
palkan
Sep 29, 2017
Collaborator
I've tried to run it with sample Rails app and got the following:
Run options: --event-prof=sql.active_record --seed 5773
# Running:
..../usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:60:in `instance_method': nil is not a symbol nor a string (TypeError)
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:60:in `location'
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:52:in `change_current_group'
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:38:in `track_current_example'
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:19:in `prerecord'
I think, this is something Rails specific but we should care.
Example app is here https://github.com/palkan/th-dummy/tree/test-prof-minitest
I've tried to run it with sample Rails app and got the following:
Run options: --event-prof=sql.active_record --seed 5773
# Running:
..../usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:60:in `instance_method': nil is not a symbol nor a string (TypeError)
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:60:in `location'
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:52:in `change_current_group'
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:38:in `track_current_example'
from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/test-prof-3b646bac1b96/lib/test_prof/event_prof/minitest.rb:19:in `prerecord'
I think, this is something Rails specific but we should care.
Example app is here https://github.com/palkan/th-dummy/tree/test-prof-minitest
Thanks for the review! |
Let's use "master"; I'll update it before releasing. |
Thanks, got it! |
@@ -13,7 +13,7 @@ def log(level, msg) | |||
end | |||
|
|||
def build_log_msg(level, msg) | |||
colorize(level, "[TEST PROF #{level.to_s.upcase}] #{msg}") | |||
colorize(level, "\n[TEST PROF #{level.to_s.upcase}] #{msg}") |
palkan
Oct 2, 2017
Collaborator
What's the reason for the change? I think, it's better to control newlines in-place and do not hide within a private method.
What's the reason for the change? I think, it's better to control newlines in-place and do not hide within a private method.
IDolgirev
Oct 2, 2017
Author
Contributor
Yep, you're right - it was just a workaround for default Minitest reporter, where progress line concatenates with EventProf message. I'll remove it.
Yep, you're right - it was just a workaround for default Minitest reporter, where progress line concatenates with EventProf message. I'll remove it.
@@ -37,7 +38,7 @@ def after_test(*); end | |||
def report | |||
@profiler.group_finished(@current_group) | |||
result = @formatter.prepare_results | |||
|
|||
puts "\n" |
palkan
Oct 2, 2017
Collaborator
Bad idea. We should output everything using log
, 'cause (in theory) it can write to file.
Just prepend the result
with "\n"
(i.e. log :info, "\n#{result}"
).
Bad idea. We should output everything using log
, 'cause (in theory) it can write to file.
Just prepend the result
with "\n"
(i.e. log :info, "\n#{result}"
).
IDolgirev
Oct 2, 2017
Author
Contributor
Actually, it won't help with the concatenation issue, because we need new line before log message itself, but not before the results. But as I wrote below I agree that it was a dumb mistake to didn't keep in mind a possibility to write results to the file :)
Actually, it won't help with the concatenation issue, because we need new line before log message itself, but not before the results. But as I wrote below I agree that it was a dumb mistake to didn't keep in mind a possibility to write results to the file :)
Frankly, I don't know what I was thinking about at that moment. Sorry for such a silly mistake :( Also there is one more thing I need to mention - even all specs are green I think that EventProf guide need to be updated a little bit with some caveat about minitest-reporters. When the user unintentionally run specs without prepending them with |
Sounds good! |
@IDolgirev Thank you for your help! I need your full name in Russian for CultOfMartians and your Twitter nickname (if any) for the announcement. |
You're welcome! Glad to help :) |
@IDolgirev Take a look, please: wrong event count https://travis-ci.org/palkan/test-prof/jobs/282329413 |
Thanks, already trying to reproduce it locally. As you see the whole group is missing in the results. I'm not quite good at multithreading and probably need some advices but at the first glance the reason is inside |
Yep, that may be the case. Not sure, but maybe Minitest automatically runs in multithreaded mode in JRuby. |
Well, I was totally unlucky yesterday so I didn't even get a chance to reproduce the error. Single spec, whole suite, random order, specific seed from Travis' failed job - nothing :( |
Have you tried JRuby?) Let's not spend too much time; I will try to investigate the next this problem occur. Thank you! |
In that case it was definitely JRuby because my machine started to work like any Dyson devices :) |
What is the purpose of this pull request?
It implements Minitest integration for EventProf (#21)
What changes did you make? (overview)
Custom Minitest plugin and reporter were added
Integration specs (based on the same Rspec ones) were added
Is there anything you'd like reviewers to focus on?
If there are no critical comments about I'll update EventProf guide