Closed rking closed 11 years ago
What version of spork-minitest are you running? Do you have SPORK_URI or SPORK_PORT environment variables set?
Oops, sorry, I see the version in the provided repository.
You are not connecting to the standard server URL druby://127.0.0.1:8988, not sure what is causing this.
Semyon,
First off, thanks for your reply. I'm on a quest to find the ultimate Ruby test setup, and Spork is one of the key ingredients.
I looked again tonight to try to figure out some more info to give you, and in the strace
output I see:
connect(12, {sa_family=AF_INET, sin_port=htons(46560), sin_addr=inet_addr("67.215.65.132")}, 16 <unfinished ...>
So that 46560
there is the same as the 32787
in my original post to this issue. That is, it's some arbitrary port trying to be used on my local machine, but in both cases it's trying to connect to zak
, which is my hostname. Since I'm running OpenDNS it resolves to 67.215.65.132
then times out.
I'll post more in a bit. I'm excited to have a clue after this not having worked for me, so far.
Made a bit of progress, still no real understanding, though.
testdrb
is basically this:
DRb.start_service
exit_code = DRbObject.new_with_uri("druby://127.0.0.1:8988").run(ARGV, $stderr, $stdout)
That DRb.start_service
ends up making a DRb::DRbServer
instance with an @uri
of "druby://zak:47696"
(the bogus URI, that is), then trying to connect to it and failling.
(Thanks!)
Can you see if DRb works on your machine at all? Try the first example at http://www.ruby-doc.org/stdlib-1.9.3/libdoc/drb/rdoc/DRb.html (run server first, then client)
Yes, the RSpec spork stuff works fine for me.
I took a look at https://github.com/dchelimsky/rspec/blob/master/lib/spec/runner/drb_command_line.rb and mimicked it.
DRb.start_service "druby://localhost:0"
exit_code = DRbObject.new_with_uri("druby://127.0.0.1:8988").run(ARGV, $stderr, $stdout)
And now it works when I do this!:
bundle exec testdrb test/foo_test.rb
Now I'm trying to figure out what's wrong with
guard 'minitest', drb: true
As it generates a failing run like this:
$ testdrb -r /home/rking/.gem/ruby/1.9.1/gems/guard-minitest-0.5.0/lib/guard/minitest/runners/default_runner.rb -e ::GUARD_NOTIFY=true test/test_helper.rb test/foo_test.rb
[test_helper.rb toplevel running]
[Spork.each_run running]
Exception encountered: #<LoadError: cannot load such file -- -r>
backtrace:
/home/rking/.gem/ruby/1.9.1/gems/spork-minitest-0.0.3/lib/spork/test_framework/minitest.rb:13:in `require'
/home/rking/.gem/ruby/1.9.1/gems/spork-minitest-0.0.3/lib/spork/test_framework/minitest.rb:13:in `block in run_tests'
/home/rking/.gem/ruby/1.9.1/gems/spork-minitest-0.0.3/lib/spork/test_framework/minitest.rb:12:in `each'
/home/rking/.gem/ruby/1.9.1/gems/spork-minitest-0.0.3/lib/spork/test_framework/minitest.rb:12:in `run_tests'
That is a different error. Spork minitest does not support options like -r and -e, it only accepts a list of files to load. Guard-minitest is currently incompatible with this gem as it was originally designed for spork-testunit. You can see a discussion at #5
Yes, I was trying to understand:
https://github.com/guard/guard-minitest/pull/41 and https://github.com/semaperepelitsa/spork-minitest/pull/5
So, I get that there is a different error there, but why did I have to edit testdrb
to say:
DRb.start_service "druby://localhost:0"
As I understand, dRuby starts a service on your computer's hostname which is named zak
. But this hostname doesn't actually point to your machine. Is there a reason to use a such hostname as default?
Using: https://github.com/rking/demo-ruby-tests/tree/debugging/guard-spork
Running
bundle exec spork minitest -p 8988
Gives:
But then
bundle exec testdrb -Itest test/foo_test.rb
Gives:
The same tests, if run as
bundle exec testrb -Itest test/foo_test.rb
work fine.