Optimisations to docker test script

This commit is contained in:
Sam 2014-06-19 15:35:24 +10:00
parent a3e3de4735
commit 0c2d346455
1 changed files with 14 additions and 6 deletions

View File

@ -9,14 +9,16 @@ desc 'Run all tests (JS and code in a standalone environment)'
task 'docker:test' do
begin
exit 1 unless run_or_fail("git remote update")
unless ENV['NO_UPDATE']
exit 1 unless run_or_fail("git remote update")
checkout = "master"
if hash = ENV['COMMIT_HASH']
checkout = hash
checkout = "master"
if hash = ENV['COMMIT_HASH']
checkout = hash
end
exit 1 unless run_or_fail("git checkout #{checkout}")
exit 1 unless run_or_fail("bundle")
end
exit 1 unless run_or_fail("git checkout #{checkout}")
exit 1 unless run_or_fail("bundle")
puts "Cleaning up old test tmp data in tmp/test_data"
`rm -fr tmp/test_data && mkdir -p tmp/test_data/redis && mkdir tmp/test_data/pg`
@ -27,6 +29,12 @@ task 'docker:test' do
@postgres_bin = "/usr/lib/postgresql/9.3/bin/"
`#{@postgres_bin}initdb -D tmp/test_data/pg`
# speed up db, never do this in production mmmmk
`echo fsync = off >> tmp/test_data/pg/postgresql.conf`
`echo full_page_writes = off >> tmp/test_data/pg/postgresql.conf`
`echo shared_buffers = 500MB >> tmp/test_data/pg/postgresql.conf`
puts "Starting postgres"
@pg_pid = Process.spawn("#{@postgres_bin}postmaster -D tmp/test_data/pg")