Skip to content

Commit

Permalink
[Truffle] skip rail integration test if Redis is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
pitr-ch committed Apr 5, 2016
1 parent 7b0b2a1 commit 7d4d142
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ env:
- JT='test specs :library'
- JT='test specs :truffle'
- JT='test integration fast'
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m"
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m" HAS_REDIS=true

matrix:
include:
Expand Down
49 changes: 28 additions & 21 deletions test/truffle/integration/rails.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,38 @@ JRUBY_BIN=../../../../bin
JRUBY=$JRUBY_BIN/jruby
JTR=$JRUBY_BIN/jruby+truffle

$JRUBY_BIN/gem install bundler
if [ -n "$CI" -a -z "$HAS_REDIS" ]
then
echo "No Redis. Skipping rails test."

$JTR setup
$JTR run -r rubygems -- bin/rails server &
serverpid=$!
url=http://localhost:3000
else

while ! curl -s "$url/people.json";
do
echo -n .
sleep 1
done
$JRUBY_BIN/gem install bundler

echo Server is up
$JTR setup
$JTR run -r rubygems -- bin/rails server &
serverpid=$!
url=http://localhost:3000

set -x
curl -s -X "DELETE" "$url/people/destroy_all.json"
test "$(curl -s "$url/people.json")" = '[]'
curl -s --data 'name=Anybody&email=ab@example.com' "$url/people.json"
echo "$(curl -s "$url/people.json")" | grep '"name":"Anybody","email":"ab@example.com"'
curl -s -X "DELETE" "$url/people/destroy_all.json"
while ! curl -s "$url/people.json";
do
echo -n .
sleep 1
done

kill %1
kill $(cat tmp/pids/server.pid)
echo Server is up

set +x
set +e
set -x
curl -s -X "DELETE" "$url/people/destroy_all.json"
test "$(curl -s "$url/people.json")" = '[]'
curl -s --data 'name=Anybody&email=ab@example.com' "$url/people.json"
echo "$(curl -s "$url/people.json")" | grep '"name":"Anybody","email":"ab@example.com"'
curl -s -X "DELETE" "$url/people/destroy_all.json"

kill %1
kill $(cat tmp/pids/server.pid)

set +x
set +e

fi

0 comments on commit 7d4d142

Please sign in to comment.