From: Brett Smith Date: Fri, 21 Mar 2014 14:26:16 +0000 (-0400) Subject: workbench: Improve API server integration launch. X-Git-Tag: 1.1.0~2690^2~19^2~23^2~5 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/3e3ef3aec33b4374a0d5cdfdb52b233499f9eb90 workbench: Improve API server integration launch. The previous version sometimes tried (and failed) to find the server pid before rails wrote it. This provides some limited retry, and avoids spawning a subshell too. --- diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb index 5d06c22006..5cd6f8421a 100644 --- a/apps/workbench/test/integration_helper.rb +++ b/apps/workbench/test/integration_helper.rb @@ -53,7 +53,12 @@ class IntegrationTestRunner < MiniTest::Unit _system('bundle', 'exec', 'rake', 'db:test:load') _system('bundle', 'exec', 'rake', 'db:fixtures:load') _system('bundle', 'exec', 'rails', 'server', '-d') - `cat tmp/pids/server.pid`.to_i + pid_path = 'tmp/pids/server.pid' + timeout = Time.now.tv_sec + 5 + while (not File.exists? pid_path) and (Time.now.tv_sec < timeout) + sleep 0.2 + end + IO.read(pid_path).to_i end begin super(args)