-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test scripts back, enable travis
- Loading branch information
Showing
5 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
language: python | ||
sudo: required | ||
services: | ||
- docker | ||
|
||
script: | ||
- ./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
|
||
PREFIX=test | ||
IMAGE=omero-server:$PREFIX | ||
|
||
CLEAN=${CLEAN:-y} | ||
|
||
cleanup() { | ||
docker rm -f -v $PREFIX-db $PREFIX-master $PREFIX-slave-1 $PREFIX-web | ||
} | ||
|
||
if [ "$CLEAN" = y ]; then | ||
trap cleanup ERR EXIT | ||
fi | ||
|
||
cleanup || true | ||
|
||
|
||
docker build -t $IMAGE . | ||
docker run -d --name $PREFIX-db -e POSTGRES_PASSWORD=postgres postgres | ||
docker run -d --name $PREFIX-master --link $PREFIX-db:db \ | ||
-p 4063:4063 -p 4064:4064 \ | ||
-e DBUSER=postgres -e DBPASS=postgres -e DBNAME=postgres \ | ||
-e ROOTPASS=omero-root-password \ | ||
$IMAGE master \ | ||
master:Blitz-0,Indexer-0,DropBox,MonitorServer,FileServer,Storm,PixelData-0,Tables-0 \ | ||
slave-1:Processor-0 | ||
|
||
docker run -d --name $PREFIX-slave-1 --link $PREFIX-master:master $IMAGE slave-1 | ||
|
||
# Smoke tests | ||
|
||
export OMERO_USER=root | ||
export OMERO_PASS=omero-root-password | ||
export PREFIX | ||
|
||
# Login to server | ||
bash test_login.sh | ||
# Wait a minute to ensure other servers are running | ||
sleep 60 | ||
# Now that we know the server is up, test Dropbox | ||
bash test_dropbox.sh | ||
# And Processor (slave-1) | ||
bash test_processor.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
set -x | ||
|
||
# Must be exported by the caller: | ||
# OMERO_USER OMERO_PASS PREFIX | ||
|
||
OMERO=/opt/omero/server/OMERO.server/bin/omero | ||
FILENAME=$(date +%Y%m%d-%H%M%S-%N).fake | ||
docker exec $PREFIX-master sh -c \ | ||
"mkdir -p /OMERO/DropBox/root && touch /OMERO/DropBox/root/$FILENAME" | ||
|
||
echo -n "Checking for imported DropBox image $FILENAME " | ||
# Retry for 4 mins | ||
i=0 | ||
result= | ||
while [ $i -lt 60 ]; do | ||
sleep 4 | ||
result=$(docker exec $PREFIX-master $OMERO hql -q -s localhost -u $OMERO_USER -w $OMERO_PASS "SELECT COUNT (*) FROM Image WHERE name='$FILENAME'" --style plain) | ||
if [ "$result" = "0,1" ]; then | ||
echo | ||
echo "Found image: $result" | ||
exit 0 | ||
fi | ||
if [ "$result" != "0,0" ]; then | ||
echo | ||
echo "Unexpected query result: $result" | ||
exit 2 | ||
fi | ||
echo -n "." | ||
let ++i | ||
done | ||
|
||
echo "Failed to find image" | ||
exit 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
set -x | ||
|
||
# Must be exported by the caller: | ||
# OMERO_USER OMERO_PASS PREFIX | ||
|
||
OMERO=/opt/omero/server/OMERO.server/bin/omero | ||
|
||
# Wait up to 2 mins | ||
i=0 | ||
while ! docker exec test-master $OMERO login -C -s localhost -u "$OMERO_USER" -q -w "$OMERO_PASS"; do | ||
i=$(($i+1)) | ||
if [ $i -ge 24 ]; then | ||
echo "$(date) - OMERO.server still not reachable, giving up" | ||
exit 1 | ||
fi | ||
echo "$(date) - waiting for OMERO.server..." | ||
sleep 5 | ||
done | ||
echo "OMERO.server connection established" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
set -x | ||
|
||
# Must be exported by the caller: | ||
# OMERO_USER OMERO_PASS PREFIX | ||
|
||
OMERO=/opt/omero/server/OMERO.server/bin/omero | ||
DSNAME=$(date +%Y%m%d-%H%M%S-%N) | ||
FILENAME=$(date +%Y%m%d-%H%M%S-%N).fake | ||
SCRIPT=/omero/util_scripts/Dataset_To_Plate.py | ||
|
||
dataset_id=$(docker exec $PREFIX-master $OMERO obj -q -s localhost -u $OMERO_USER -w $OMERO_PASS new Dataset name=$DSNAME | cut -d: -f2) | ||
|
||
docker exec $PREFIX-master sh -c \ | ||
"touch /tmp/$FILENAME && $OMERO import -d $dataset_id /tmp/$FILENAME" | ||
|
||
docker exec $PREFIX-master $OMERO script launch $SCRIPT IDs=$dataset_id | ||
echo "Completed with code $?" | ||
|
||
result=$(docker exec $PREFIX-master $OMERO hql -q -s localhost -u $OMERO_USER -w $OMERO_PASS "SELECT COUNT(w) FROM WellSample w WHERE w.well.plate.name='$DSNAME' AND w.image.name='$FILENAME'" --style plain) | ||
if [ "$result" != "0,1" ]; then | ||
echo "Script failed: $result" | ||
exit 2 | ||
fi |