Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Explicitly initialize the object store during azure integration tests
  • Loading branch information
hardbyte committed Apr 20, 2020
commit 04ee7e2cb0910a7b465e46ce33f3cae0721684f7
11 changes: 6 additions & 5 deletions .azurePipeline/runDockerComposeTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage: $SCRIPT_NAME [parameters]

Script run by the Azure Pipeline to start all the services required by the entity service with
docker-compose and the test or benchmark container, copying the results in a chosen file.
The result is an xml file for the type 'tests' and 'tutorials', and a JSON file for the type 'benchmark'.
The result is an xml file for the type 'integrationtests' and 'tutorials', and a JSON file for the type 'benchmark'.

-p Project name (used by docker-compose with '-p'). REQUIRED.
-o Output file where to store the results. [$RESULT_FILE]
Expand Down Expand Up @@ -60,9 +60,11 @@ commandPrefix="docker-compose -f tools/docker-compose.yml -f tools/ci.yml --proj
if [[ "$NO_ANSI" == "TRUE" ]]; then
commandPrefix="$commandPrefix --no-ansi "
fi

echo "Initialise the database"
$commandPrefix -p $PROJECT_NAME up db_init > /dev/null 2>&1

echo "Initialise the database and the object store"
$commandPrefix -p $PROJECT_NAME up objectstore_init db_init
echo "Initialisation complete"


if [[ $TYPE == "integrationtests" ]]; then
CREATED_RESULT_FILE="/var/www/testResults.xml"
Expand All @@ -75,7 +77,6 @@ else
exit 1
fi

echo "Start type $TYPE"
$commandPrefix -p $PROJECT_NAME up --abort-on-container-exit --exit-code-from $TYPE db minio redis backend worker nginx $TYPE
exit_code=$?
echo "Retrieve the $TYPE tests results."
Expand Down
5 changes: 3 additions & 2 deletions e2etests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ RUN python -c "import anonlink; print('anonlink version:', anonlink.__version__)
python -c "import clkhash; print('clkhash version:', clkhash.__version__)"

ENV SERVER http://nginx:8851
ENV INITIAL_DELAY 20
CMD python -m pytest -n 2 e2etests/tests --junitxml=testResults.xml -x

CMD dockerize -wait tcp://db:5432 -wait tcp://nginx:8851/api/v1/status -timeout 5m \
/bin/sh -c "sleep 5 && python -m pytest -n 2 e2etests/tests --junitxml=testResults.xml -x"
3 changes: 1 addition & 2 deletions tools/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ services:
image: data61/anonlink-test:${TAG:-latest}
environment:
- SERVER=http://nginx:8851
- INITIAL_DELAY=20
- JAEGER_AGENT_HOST=jaeger
depends_on:
- backend
Expand All @@ -22,7 +21,7 @@ services:
- UPLOAD_OBJECT_STORE_ACCESS_KEY=EXAMPLE_UPLOAD_ACCESS_KEY
- UPLOAD_OBJECT_STORE_SECRET_KEY=EXAMPLE_UPLOAD_SECRET_ACCESS_KEY
command: dockerize -wait tcp://db:5432 -wait tcp://nginx:8851/api/v1/status -timeout 5m
/bin/sh -c "sleep 30 && python -m pytest -n 1 entityservice/integrationtests --junitxml=testResults.xml -x"
/bin/sh -c "sleep 10 && python -m pytest -n 1 entityservice/integrationtests --junitxml=testResults.xml -x"
depends_on:
- db
- backend
Expand Down
6 changes: 3 additions & 3 deletions tools/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ services:
objectstore_init:
image: minio/mc:RELEASE.2020-04-19T19-17-53Z
environment:
- INITIAL_DELAY=10
# Provide root credentials to MINIO to set up more restricted service accounts
# MC_HOST_alias is equivalent to manually configuring a minio host
# mc config host add minio http://minio:9000 <MINIO_ACCESS_KEY> <MINIO_SECRET_KEY>
- MC_HOST_minio=http://AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY@minio:9000
# Account which will have upload only object store access.
- UPLOAD_ONLY_ACCESS_KEY=EXAMPLE_UPLOAD_ACCESS_KEY
- UPLOAD_ONLY_SECRET_ACCESS_KEY=EXAMPLE_UPLOAD_SECRET_ACCESS_KEY
entrypoint: sh /opt/init-object-store.sh
entrypoint: |
/bin/sh /opt/init-object-store.sh
volumes:
- "./init-object-store.sh:/opt/init-object-store.sh"
- ./tools/init-object-store.sh:/opt/init-object-store.sh:ro
depends_on:
- minio

Expand Down
3 changes: 1 addition & 2 deletions tools/init-object-store.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
echo "== Initialising Object Store =="
mc --version
sleep ${INITIAL_DELAY}
echo "== Initialising Object Store =="
mc mb minio/uploads
mc admin user add minio $UPLOAD_ONLY_ACCESS_KEY $UPLOAD_ONLY_SECRET_ACCESS_KEY
mc admin policy set minio writeonly user=$UPLOAD_ONLY_ACCESS_KEY
Expand Down