[Groonga-commit] droonga/drntest at aeee1b2 [master] Wait until engine gets ready

Back to archive index

Yoji Shidara null+****@clear*****
Tue Nov 26 15:27:23 JST 2013


Yoji Shidara	2013-11-26 15:27:23 +0900 (Tue, 26 Nov 2013)

  New Revision: aeee1b2c73dd089f3ae42b8a5fc78fcf7abff60b
  https://github.com/droonga/drntest/commit/aeee1b2c73dd089f3ae42b8a5fc78fcf7abff60b

  Message:
    Wait until engine gets ready

  Modified files:
    lib/drntest/test-runner.rb

  Modified: lib/drntest/test-runner.rb (+18 -0)
===================================================================
--- lib/drntest/test-runner.rb    2013-11-26 15:18:33 +0900 (82ad8a7)
+++ lib/drntest/test-runner.rb    2013-11-26 15:27:23 +0900 (17c38a2)
@@ -123,6 +123,8 @@ module Drntest
       arguments = [engine_env, *engine_command]
       arguments << engine_options
       @engine_pid = Process.spawn(*arguments)
+
+      wait_until_engine_ready
     end
 
     def teardown
@@ -266,5 +268,21 @@ module Drntest
       file.close
       yield(file)
     end
+
+    def engine_ready?
+      begin
+        socket = TCPSocket.new(@host, @port)
+        socket.close
+        true
+      rescue Errno::ECONNREFUSED
+        false
+      end
+    end
+
+    def wait_until_engine_ready
+      until engine_ready?
+        sleep 1
+      end
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index