From 23a65392c4dd88f28cbf94ac451bd1f1d9cd0be4 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Tue, 25 Mar 2014 15:10:24 -0400 Subject: [PATCH] workbench: Timeout integration test Rails launch. --- apps/workbench/test/integration_helper.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb index d5de3319fb..86162834c7 100644 --- a/apps/workbench/test/integration_helper.rb +++ b/apps/workbench/test/integration_helper.rb @@ -51,14 +51,19 @@ class IntegrationTestRunner < MiniTest::Unit _system('bundle', 'exec', 'rake', 'db:test:load') _system('bundle', 'exec', 'rake', 'db:fixtures:load') _system('bundle', 'exec', 'rails', 'server', '-d') + timeout = Time.now.tv_sec + 10 begin + sleep 0.2 begin server_pid = IO.read(SERVER_PID_PATH).to_i + good_pid = (server_pid > 0) and (Process.kill(0, pid) rescue false) rescue Errno::ENOENT - sleep 0.2 + good_pid = false end - end until (not server_pid.nil?) and (server_pid > 0) and - (Process.kill(0, server_pid) rescue false) + end while (not good_pid) and (Time.now.tv_sec < timeout) + if not good_pid + raise RuntimeError, "could not find API server Rails pid" + end server_pid end begin -- 2.30.2