On Jun 26, 1:13 pm, poopdevi... / gmail.com wrote:
> On Jun 26, 12:57 am, Sylvain Joyeux <sylvain.joy... / polytechnique.org>
> wrote:
>
> > You're calling DRb.start_service a lot. In my experience, this can lead to
> > problems. Try adding DRb.stop_service in #teardown.
> > --
> > Sylvain Joyeux
>
> Well, I refactored the tests so that Drb.start_service is only called
> once.  I still get the name dependent failure.
>
> require 'drb'
> require 'test/unit'
> require '../lib/classes/Config.rb'
> require '../lib/classes/Service.rb'
>
> class TestService < Test::Unit::TestCase
>
>   @@config = {:url => 'druby://localhost:9001',}.to_config
>   @@remote_service = Service.new(@@config) # calls DRb.service_start
>
>   def test_service_stat # fails
>     message = {:data => [1,1,1], :mixin => :statistics}.to_config
>     service = DRbObject.new(nil, @@config.url)
>     assert_equal([:statistics, 1, 0], service.process(message))
>   end
>
>   def test_service_trivial
>     message = {:data => 1, :mixin => :trivial}.to_config
>     service = DRbObject.new(nil, @@config.url)
>     assert_equal(service.process(message),1)
>   end
> end
>
> EOC
>
> One thing I forgot to mention is that test_service_statistics fails
> with:
>
> <[:statistics, 1, 0]> expected but was
> <[1, 1, 1]>
>
> which means that it was actually using Trivial::run(data) instead of
> Statistics::run(data).  Is DRb threaded?  Could this be a race
> condition in DRb and not my code?  (I can't see how it would by a bug
> in my code)

My mistake.  DRb is obviously threaded.  I meant to ask if Test::Unit
is threaded, and if there might be a race condition there.

Alex