diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-02-07 16:38:41 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-02-07 16:38:41 -0800 |
commit | ffc4ec4baaae5020c98dc545c6c6ade0336a3311 (patch) | |
tree | 405052968f91538a0588a8bc69898cb876c2161c | |
parent | fb8874fbf719264064bf9761476de4c16d7f8c89 (diff) | |
download | mogilefs-client-ffc4ec4baaae5020c98dc545c6c6ade0336a3311.tar.gz |
Not sure how hosts was ever allowed to be a String, but sort_by does not work on Strings in 1.9 so this was a bug before, too. Also I'm not sure how the accept_nr variable gets shared between threads; better just to use sockets for here...
-rw-r--r-- | test/test_backend.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/test_backend.rb b/test/test_backend.rb index 7cda231..58dd775 100644 --- a/test/test_backend.rb +++ b/test/test_backend.rb @@ -43,7 +43,7 @@ class TestBackend < Test::Unit::TestCase client.send "OK 1 you=win\r\n", 0 end) - @backend.hosts = "127.0.0.1:#{tmp.port}" + @backend.hosts = [ "127.0.0.1:#{tmp.port}" ] assert_equal({'you' => 'win'}, @backend.do_request('go!', { 'fight' => 'team fight!' })) @@ -195,15 +195,18 @@ class TestBackend < Test::Unit::TestCase tmp = TempServer.new(Proc.new do |serv,port| client, client_addr = serv.accept accept_nr += 1 + r = IO.select([client], [client]) + client.syswrite(accept_nr.to_s) sleep end) @backend = MogileFS::Backend.new :hosts => [ "127.0.0.1:#{tmp.port}" ] assert @backend.socket assert ! @backend.socket.closed? + IO.select([@backend.socket]) + resp = @backend.socket.sysread(4096) @backend.shutdown assert_equal nil, @backend.instance_variable_get(:@socket) - assert_equal 1, accept_nr - + assert_equal 1, resp.to_i ensure TempServer.destroy_all! end |